Is there any way to fix the grey area in the jpeg file?

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
sasha
Posts: 1
Joined: 2016-08-24T04:16:40-07:00
Authentication code: 1151

Is there any way to fix the grey area in the jpeg file?

Post by sasha »

Hi there!
I have a jpeg file that has a grey area on the bottom of itself.
My jpeg file has not the end bytes "ff d9" on the end of itself. I don't find the bytes in a hex-editor.
I tried to fix this and added "ff d9", but the grey area didn't disappear anyway.

Jpeginfo shows the following warning: "premature end of JPEG file". Also I have another title of the problem "incomplete JPEG scan (grey area in the image)".

Is it possible to fix this?
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Is there any way to fix the grey area on the jpeg file?

Post by Bonzo »

I would guess it is a faulty file usually caused by something going wrong with the generation. There is probably no image data beyond that point and that is why it is grey and sometimes black.
You would have to upload it to a file sharing service so people could take a look at it.

There is usually a thumbnail in the EXIF data which may be OK and you can sometimes recover that; but I can not remember how at the moment. This would be a very small file size though.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Is there any way to fix the grey area in the jpeg file?

Post by snibgo »

exiftool can say whether there is a thumbnail. If there is, then something like this might work:

Code: Select all

exiftool -Composite:ThumbnailImage -b badfile.jpg >out_thumb.jpg
snibgo's IM pages: im.snibgo.com
Post Reply