Some converted jpg from tiff files don't show in browser

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
jasonmmiller

Some converted jpg from tiff files don't show in browser

Post by jasonmmiller »

I'm rather new with ImageMagick and have been tasked with converting 700 TIFF images to jpg, no problem right?!

Most of them are fine, but a select few (around 25) do not show up either IE or Mozilla, even though they open up fine in every graphics program. Has anyone see this before?

I did note that the problem TIFFs are all 32 Bit color, 300x300 dpi, while all the ones that worked are only 8 bit. I tried to use the "-depth 8" to change it on the fly but that didn't work either.

Thanks for any help you can provide!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Some converted jpg from tiff files don't show in browser

Post by anthony »

What command did you try that failed?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
jasonmmiller

Re: Some converted jpg from tiff files don't show in browser

Post by jasonmmiller »

convert -quality 75 -resample 72x72 -depth 8 -geometry 230 -compress JPEG "...6HD719.tif" "...6HD719.jpg"

I tried it with and without -quality, -resample, -depth, and -geometry in efforts to avoid any issues. I also tried just tiff to tiff to reduce the depth to 8-bit which didn't work either. It did however reduce the dpi as instructed, it just didn't reduce the depth from 32-bit.
brendan

Re: Some converted jpg from tiff files don't show in browser

Post by brendan »

I don't think you need the -compress option, though that may not be the source of your woes.

Do the final jpg images otherwise display properly in other software?

When you compare the results of identify -verbose for the two types of tiff, what does it say about the compression?
jasonmmiller

Re: Some converted jpg from tiff files don't show in browser

Post by jasonmmiller »

The compression is the same. Here are the significant differences:

Good:
Type: Grayscale
Colorspace: Gray
Gray: 8-bit
Channel depth:
Compression: ColorBurn
Tiff:rows-per-strip: 12
Bad:
Type: ColorSeparation
Colorspace: CMYK
Channel depth:
Cyan: 1-bit
Magenta: 1-bit
Yellow: 1-bit
Black: 8-bit
Compression: ColorBurn
Tiff:rows-per-strip: 2

Could it be that these images aren't grayscale? This seems to be another common thread...
brendan

Re: Some converted jpg from tiff files don't show in browser

Post by brendan »

Do the bad jpgs display in applications other than a web-browser? For example, WindowsXP image preview or ImageMagick display?

Perhaps you should manually specify the colorspace (shot in the dark...):

Code: Select all

convert -colorspace CMYK -quality 75 -resample 72x72 -depth 8 -geometry 230  "...6HD719.tif" "...6HD719.jpg"
jasonmmiller

Re: Some converted jpg from tiff files don't show in browser

Post by jasonmmiller »

Sorry I forgot to address that again. Yes, they do open up fine in every graphics package.

Excellent. Your suggestion led me to look at the -colorspace option which requires the use of the -colors option. -colors set the preferred number of colors, and since I only need a grayscale image I went with 256 and RGB for the -colorspace, and the image displays perfectly.

I tried a few more with [borat]great success[/borat]!

Thanks much, I'm very grateful!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Some converted jpg from tiff files don't show in browser

Post by anthony »

I also suggest you do your operations in the right order, otherwise IM has to make a guess. See Basics Page in IM examples.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply