Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

accidentally ran dos2unix over group of jpg....

Status
Not open for further replies.

narnar124

IS-IT--Management
Jan 28, 2011
4
LB
I accidentally ran dos2unix command to a group of jpg images..now the images won't open with any software...please any tip??
 
Maybe try running unix2dos over them in the hope that this reverses the process?

The internet - allowing those who don't know what they're talking about to have their say.
 
Do you have backup?

The internet - allowing those who don't know what they're talking about to have their say.
 
I thought that might be the answer - not sure where we go from here! Anyone else any ideas?

The internet - allowing those who don't know what they're talking about to have their say.
 
Only thing that I can suggest is since d2u and u2d adjust for the line feed is to take a sample jpg file and view it in an editor then run the d2u on it and compare to see what type of changes were made.

[Blue]Blue[/Blue] [Dragon]

If I wasn't Blue, I would just be a Dragon...
 
The problem is that a JPG is mostly a binary file. The utilities dos2unix and unix2dos are text utilities that do a simple replace on end-of-line characters. The problem is that the image data, when viewed as text, contains a lot of CR & LF characters. These aren't actual CRs and LFs, but just random occurrences of those values.

So, the first pass of dos2unix basically corrupted file file. The pass of unix2dos may have undone some of the changes that dos2unix did, but it also grabbed any characters that matched a LF character and inserted a CR before it, which just added more file corruption.

Another part of the problem is that JPG files compress the image. This means they are a little more sensitive to corruption. Corruption can make it so it can't be uncompressed.

So, the bottom line is, these files are probably toast. You'll need to find copies somewhere else.

If these were in a web app, you might look in your browser cache for copies. The file names will be different, but you might be able to view them by renaming the extension to ".jpg".

Good luck!


 
Well thank you all for your replies and suggestions but I'm quite convinced now that these files are history...learned it the hard way:BACKUP BACKUP!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top