Converting between TIFF, PNG, JPEG2000 with 16bits and ICM

Discussion in 'Digital Darkroom' started by og, Nov 1, 2003.

  1. og


    I scan my negatives as TIFF 16 bits with ICM embedded. I wanted to
    archive those files into PNG or JPEG2000 to save some space (lossless).

    IrfanView and ImageMagick can read/write 16 bits files in TIFF and
    JPEG2000 (write 8 bits only in PNG). Unfortunately, none of them do
    keep the ICM embedded profile (Adobe RGB, here).

    So, how do you convert your 16 bits files with ICM into JPEG2000, PNG
    or TIFF(LZW) and keep all the information (16 bits & ICM) ?

    I don't have PhotoShop.

    Thank you

  2. Olivier,
    I just tried this with imagemagick:
    mogrify -format png 16Bit.tif
    where 16Bit.tif is a 16-bit tiff file tagged with Adobe RGB icm profile. What I got from that was a 16 bit png file called 16Bit.png still tagged with Adobe RGB icm profile.
    I also did this:
    mogrify -profile AdobeRGB1998.icc 16Bit.tiff
    where this time 16Bit.tiff is a 16-bit tiff file with NO icc profile and AdobeRGB1998.icc is a copy of the profile in the same directory. This gave me a file with the same name, but this time tagged with the icc profile
    I'm using OS X with ImageMagick 5.5.1 10/15/02 and it seems to be working. How are you using ImageMagick?
  3. There's also Picture Window Pro, but I don't think it'll do JPEG2000.
  4. IrfanView and ImageMagick can read/write 16 bits files in TIFF and JPEG2000 (write 8 bits only in PNG). Unfortunately, none of them do keep the ICM embedded profile (Adobe RGB, here).
    Forgive me if I am stating the obvious, but could you not use IrfanView to convert your files to PNG or JPEG 2000, followed by ImageMagick to embed the profile?
    Here is another JPEG 2000 conversion utility (I have not tested it):
  5. I'm pretty sure ImageMagick did 16 bit image to PNG 16 bit -conversions. Also, using the "profile tagging" works well.
  6. og


    Ooppss... I have to say that I used ImageMagick Studio (on the net), without going very deeply into it. Sorry.

    So, I am going to install ImageMagick and really use it. Thank you Mark for your feedback.

    My next grip is that I am not able to find a compiled binary version of Jasper (1.700.5 for win32 XP), which is necessary for JPEG2000. Do you have any idea ? (would someone be able to compile the source and send it by email?)

    I hope that Window Picture Pro will be able to handle JPEG2000 soon. (note: IrfanView can save small JPEG2000 for free, for 640x480 an bigger you have to buy the plug-in).

  7. og


    Update: I am right now 'playing' with ImageMagick 5.5.8(Beta)-Q16 for windows, and everything is included (PNG, JPEG2000...). I will give some more info later (compression comparisons, CPU usage, ICC, compatibility...).
  8. og


    The most interesting results so far are with ImageMagick: Conversion for TIFF, PNG, JPEG 2000 in 16bits. For PNG & TIFF: the ICM Profile is still tagged. For JPEG2000, the ICM tag is lost (even if it is applied again with ImageMagick) - probably a problem between ImageMagick and Jasper(JPEG2000).

    TESTS (filesize in KiloByte):

    File 1 (3848x2552_3x16bits): TIFF(uncompressed)=57542 / PNG(Q100)=53471 (best with PNGCrush-Brute=51327) / JPEG2000(Q100=Lossless)=24538

    File 2 (2608x3880_3x16bits): TIFF(uncompressed)=59322 / PNG(Q100)=53460 / JPEG2000(lossless)=22483

    File 3 (File 2, in 3x8bits): TIFF(uncompressed)=29646 / JPEG2000(lossless)=13017

    File 4 (File 2, half-size in 3x16bits): TIFF(uncompressed)=14839 / PNG(Q100)=13643 / JPEG2000(lossless)=6637


    In filesize (based on 1&2): TIFF=100% / PNG=91% / JPEG2000=40%

    I expected better compression from PNG.

    JPEG2000(lossless) is really impressive... (I even had a doubt about '-quality 100' being the right setting. But '-compress lossless' is not working with JPEG2000, and more important: The Admin of ImageMagick Forum comfirmed that '-quality 100' was the lossless setting of the Codec. This is not said in Docs!). The compression in JPEG2000 is slower than in PNG (about 3x), but still ok. However, the RAM requirements are huge: about 10x the uncompressed Filesize. And if you use the swap-file, you're going to wait a lot more and kill your hard-drive! IrfanView can browse large files in 16bits JPEG2000, but it is really slow and it doesn't cache Thumbnails. (IrfanView cannot write 16bits TIFF. Sorry about that).

    Additional notes:

    Picture Window Pro 3.5 can read PNG 16bits files, but as 8bits images (it doesn't warn...) and without the ICM Profile. It can't read/write TIFF with LZW. It doesn't read/write JPEG2000 at all.

    I guess that PhotoShop CS does everything (or even 7 with Plug-In)...
  9. og


    I also checked for data alteration:

    Visual verification : same color, same detail/sharpness for TIFF & JPEG2000 (just to check obvious bugs...).

    File Information (-verbose): ICM Profile is lost, Resolution data is lost, # of colors are different (TIFF=9632327 -> JPEG2000=9662326 -> TIFF=9669053) and Signature are different.

    Hum... Not exactly Lossless (cf # of colors & Signature).

    I'll try to get some information from an ImageMagick/Jasper/JPEG2000 Geek...
  10. Those PNG compression numbers look very poor. I was able to systematically get 20-25% of compression with 16 bit images and 55% with 8 bit image when converting to PNG and your numbers are notably worse.
  11. og


    Update: the current distribution of ImageMagick with JPEG2000 is not completely Lossless. You should wait for the next release (about 2 weeks) ( ). So the results of JPEG2000, here, are not accurate.

    Oskar, a lot of my photos are on 400 ISO Color Negatives (handheld at dawn/dusk), and the Grain is really visible on the Scans. The strong Grain pattern probably makes Image Compression more difficult. I believe that a 100 ISO slide, or a digital output would achieve better compression ratio.


Share This Page