Page 1 of 1
Convert PNG32 to Jpeg2000,reduce size and keep transparency?
Posted: 2014-02-04T01:56:56-07:00
by robertraiz
Hello all,
I would need some assistance in making this happen. I have some png32 tiles with dimensions ~270 KiB and I managed to reduce the size and keep the quality like this:
convert my_file.png -define jp2:rate=0.3 -define compression=JPEG2000 my_file.jp2
It all worked well until I saw that it does not keep the transparency. I tried several options but I am probably mussing something obvious. Can you please point me in the right direction.
If you also have another image format that can keep a good quality wile having a small size and support transparency, please let me know to try it out.
Thanks a ton!
Re: Convert PNG32 to Jpeg2000,reduce size and keep transpare
Posted: 2014-02-04T04:08:47-07:00
by snibgo
Using IM v6.8.8-0 on Windows 8.1, jp2 retains transparency. For example:
Code: Select all
convert -size 300x200 -background none label:snibgo s.jp2
What IM version are you using?
Re: Convert PNG32 to Jpeg2000,reduce size and keep transpare
Posted: 2014-02-04T06:21:47-07:00
by robertraiz
Hello,
I am using imagemagick-6.8.5.4 on Unix; if I use your example I just have a black box.
Do you have the jasper delegate library installed?
Check your delegates via
convert -version
does it list jp2 or jp2000
Re: Convert PNG32 to Jpeg2000,reduce size and keep transpare
Posted: 2014-02-04T08:56:43-07:00
by snibgo
Something about your build process is probably different to mine. I just use the Windows pre-built binaries. I suggest you look at other threads on JP2.
Re: Convert PNG32 to Jpeg2000,reduce size and keep transpare
Posted: 2014-02-04T13:13:33-07:00
by mrmattnc
can you post a sample image?
Is size reduction with transparency intact your only goal? Could we reduce the color depth, or strip metadata to save size? What is your target size?
Does Jpeg2000 support transparency? Normal jpg does not?
Re: Convert PNG32 to Jpeg2000,reduce size and keep transpare
Posted: 2014-02-05T03:25:52-07:00
by robertraiz
Hello,
Yes, jp2000 supports transparency.
I managed to fix it by running the same command as in the first post, but on version 6.7.8-8 2013-03-18 Q16 (on a virtual machine)
For this version, when I run convert -version I have listed only these (no delegates)
"6.7.8-8 2013-03-18 Q16"
"Features: OpenMP"
The other version from the first example uses 6.8.5.4 and has many more listed, including delegates: jp2
Re: Convert PNG32 to Jpeg2000,reduce size and keep transpare
Posted: 2014-02-05T08:39:46-07:00
by mrmattnc
I don't think new versions list delegates when you run -version.
Try convert -list Format.
Glad you got it fixed
Re: Convert PNG32 to Jpeg2000,reduce size and keep transpare
Posted: 2014-02-05T11:17:53-07:00
by fmw42
mrmattnc wrote:I don't think new versions list delegates when you run -version.
The older versions of IM did not list delegates and one would have to do convert -list configure to get them. But the newer versions of IM do list delegates as for example on my system
convert -version
Version: ImageMagick 6.8.8-4 Q16 x86_64 2014-01-29
http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules
Delegates: bzlib cairo fftw fontconfig freetype gslib jbig jng jpeg lcms lqr ltdl lzma openexr png ps rsvg tiff webp x xml zlib