Convert PNG32 to Jpeg2000,reduce size and keep transparency?

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
robertraiz
Posts: 11
Joined: 2014-02-04T01:40:44-07:00
Authentication code: 6789

Convert PNG32 to Jpeg2000,reduce size and keep transparency?

Post by robertraiz » 2014-02-04T01:56:56-07:00

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!

snibgo
Posts: 12142
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert PNG32 to Jpeg2000,reduce size and keep transpare

Post by snibgo » 2014-02-04T04:08:47-07:00

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?
snibgo's IM pages: im.snibgo.com

robertraiz
Posts: 11
Joined: 2014-02-04T01:40:44-07:00
Authentication code: 6789

Re: Convert PNG32 to Jpeg2000,reduce size and keep transpare

Post by robertraiz » 2014-02-04T06:21:47-07:00

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

snibgo
Posts: 12142
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert PNG32 to Jpeg2000,reduce size and keep transpare

Post by snibgo » 2014-02-04T08:56:43-07:00

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.
snibgo's IM pages: im.snibgo.com

mrmattnc
Posts: 22
Joined: 2014-02-04T11:23:37-07:00
Authentication code: 6789

Re: Convert PNG32 to Jpeg2000,reduce size and keep transpare

Post by mrmattnc » 2014-02-04T13:13:33-07:00

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?

robertraiz
Posts: 11
Joined: 2014-02-04T01:40:44-07:00
Authentication code: 6789

Re: Convert PNG32 to Jpeg2000,reduce size and keep transpare

Post by robertraiz » 2014-02-05T03:25:52-07:00

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

mrmattnc
Posts: 22
Joined: 2014-02-04T11:23:37-07:00
Authentication code: 6789

Re: Convert PNG32 to Jpeg2000,reduce size and keep transpare

Post by mrmattnc » 2014-02-05T08:39:46-07:00

I don't think new versions list delegates when you run -version.

Try convert -list Format.

Glad you got it fixed :D

User avatar
fmw42
Posts: 25543
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert PNG32 to Jpeg2000,reduce size and keep transpare

Post by fmw42 » 2014-02-05T11:17:53-07:00

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

Post Reply