Quality loss with JPEG2000?

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?".
Locked
syamashi
Posts: 12
Joined: 2012-10-05T11:09:07-07:00
Authentication code: 67789

Quality loss with JPEG2000?

Post by syamashi »

Hello,

I'm trying to look into the capabilities of JPEG2000 file format and experiencing file conversion challenges from TIF format. It seems that sometimes the converted images contain dark rectangles spotted in various parts in an image. Most of the time this happens in the very bright parts in an image. Here is the command I run:

Code: Select all

convert input.jpg -define numrlvls=7 -define jp2:tilewidth=256 -define jp2:tileheight=256 -define jp2:rate=0.02348 -define jp2:prg=rpcl -define jp2:mode=int -define jp2:prcwidth=256 -define jp2:prcheight=256 -define jp2:cblkwidth=64 -define jp2:cblkheight=64 -define jp2:sop output.jp2 
Is there a way I can get rid of these artifacts by tweaking parameters?

thanks,

Wolfgang Woehl
Posts: 34
Joined: 2010-02-25T15:22:50-07:00
Authentication code: 8675308

Re: Quality loss with JPEG2000?

Post by Wolfgang Woehl »

jp2:rate is probably too low.

syamashi
Posts: 12
Joined: 2012-10-05T11:09:07-07:00
Authentication code: 67789

Re: Quality loss with JPEG2000?

Post by syamashi »

jp2:rate didn't seem to work but the example of the lossless encoding option on the ImageMagick example did work.

Code: Select all

$ convert input.tif -define numrlvls=6 -define jp2:tilewidth=1024 -define jp2:tileheight=1024 \
-define jp2:rate=1.0 -define jp2:lazy -define jp2:prg=rlcp -define jp2:ilyrrates=\
'0.015625,0.01858,0.0221,0.025,0.03125,0.03716,0.04419,0.05,0.0625, 0.075,0.088,0.1,0.125,0.15,0.18,0.21,0.25,0.3,0.35,0.4,0.5,0.6,0.7,0.84' \
-define jp2:mode=int output.jp2
http://www.imagemagick.org/script/jp2.php

However, the file comes out in around 200MB which was around 10MB with the original conversion. How and which parameters can I tweak to adjust conversion without losing too much of the quality? My goal is to limit the file size under 80MB without having those rectangular artifacts.

syamashi
Posts: 12
Joined: 2012-10-05T11:09:07-07:00
Authentication code: 67789

Re: Quality loss with JPEG2000?

Post by syamashi »

Is there a way to downsize an image by adjusting "jp2:ilyrrates"? How do I come up with these rates?

syamashi
Posts: 12
Joined: 2012-10-05T11:09:07-07:00
Authentication code: 67789

Re: Quality loss with JPEG2000?

Post by syamashi »

Interestingly, jp2:rate values did not affect but jp2:prg value did. I hope someone can explain what's going on..

Code: Select all

convert input.tif -define numrlvls=7 -define jp2:tilewidth=1024 -define jp2:tileheight=1024 -define jp2:rate=0.01 -define jp2:mode=int -define jp2:prcwidth=1024 -define jp2:prcheight=1024 -define jp2:cblkwidth=64 -define jp2:cblkheight=64 -define jp2:prg=rlcp ouput.jp2

Locked