Page 1 of 2

JNG Bugs

Posted: 2011-12-28T01:53:03-07:00
by Solovei95
I found a bug with the JNG. This is not true that the quality parameter is common to all (0-100).
Must be 6 characters: alpha channel, and the image itself.

JNG Bug [FIXED]

Posted: 2011-12-28T08:56:20-07:00
by glennrp
It is a documentation bug. ImageMagick-5.5.7 had this:
  • When writing a JNG image with transparency, two quality values are required,
    one for the main image and one for the grayscale image that conveys the opacity
    channel. These are written as a single integer equal to the main image
    quality plus 1000 times the opacity quality. For example, if you want to
    use quality 75 for the main image and quality 90 to compress the opacity
    data, use -quality 90075.
Somehow the paragraph got lost in IM 6. I'm restoring it now; it should appear in
IM-6.7.4-3.

Re: JNG Bugs

Posted: 2011-12-28T21:52:27-07:00
by Solovei95
I think that for a chunk JDAA also need to introduce quality, for example 100100. In addition, JDAA should be able to customize the sample factor separately from JDAT.

Re: JNG Bugs

Posted: 2011-12-29T08:02:09-07:00
by glennrp
Solovei95 wrote:I think that for a chunk JDAA also need to introduce quality, for example 100100. In addition, JDAA should be able to customize the sample factor separately from JDAT.
I agree and will look at that.

Re: JNG Bugs

Posted: 2011-12-31T09:23:46-07:00
by glennrp
glennrp wrote:
Solovei95 wrote:I think that for a chunk JDAA also need to introduce quality, for example 100100. In addition, JDAA should be able to customize the sample factor separately from JDAT.
I agree and will look at that.
Please try SVN revision 6300. If the main image quality is less than 90
then sampling factors are 2,1,1, otherwise 1,1,1. But the JDAA sampling factors are
always 1,1,1 (no downsampling) because the JDAA "image" is grayscale.
Use "-compress zip" to request that the alpha channel be written in PNG IDAT
chunks instead of JDAA.

Re: JNG Bugs

Posted: 2011-12-31T21:51:07-07:00
by Solovei95
Вы сказали, что нужно использовать -compress zip, но этот компресс по умолчанию используется.
Вы имели ввиду -compress jpeg ?

Re: JNG Bugs

Posted: 2011-12-31T21:58:08-07:00
by Solovei95
Скажите, как поменять глубину цвета альфа-канала (PNG) на 1 бит?

Re: JNG Bugs

Posted: 2012-01-01T11:09:24-07:00
by glennrp
Solovei95 wrote:Вы сказали, что нужно использовать -compress zip, но этот компресс по умолчанию используется.
Вы имели ввиду -compress jpeg ? [google translation: You said that you need to use -compress zip, but this pack is used by default.
Did you mean -compress jpeg?]
Use -compress jpeg to force the alpha channel to be stored as a JDAA, -compress zip to force it to be stored as an IDAT.
The "default" cannot be depended upon; if the original image was a JPEG, then image->compress will be JPEG, but if
it was a GIF or PNG then image->compress will be Zip. When you are writing a JNG it is a good idea to use the
-compress option to be sure. The main image in a JNG is always written as JPEG no matter what is the value of image->compress.

Re: JNG Bugs

Posted: 2012-01-01T11:28:18-07:00
by glennrp
Solovei95 wrote:Скажите, как поменять глубину цвета альфа-канала (PNG) на 1 бит? [Tell me how to change the color depth of an alpha channel (PNG) for a bit?]
The depth of the alpha channel in a PNG is always the same as the depth of the RGB channels. In the case of a JNG, if the alpha channel that you supplied is all 0 and maxval (binary transparency) and you used -compress zip, then the PNG-encoded alpha channel will be 1-bit. Otherwise, I believe you can control the bit depth of the PNG-encoded alpha channel with the
-define png:bit-depth=N option.
  • For example:

    8-bit main JPEG image, 1-bit alpha IDAT:
    convert in.png -define png:bit-depth=1 -compress zip out.jng

    8-bit main JPEG image, 16-bit alpha IDAT:
    convert in.png -define png:bit-depth=16 -compress zip out.jng

    8-bit main JPEG image, 8-bit alpha JDAA:
    convert in.png -compress jpeg out.jng

Re: JNG Bugs

Posted: 2012-01-01T19:44:01-07:00
by Solovei95
Есть проблема с JNG альфа-каналом. Что сделать глубину альфа-канала на 1, нужно уменьшить альфа-канал до 2 цветов. Сделать это можно только при помощи -channel A -threshold n (все равно одна и та же картина)
-black-threshold и -white-threshold работают не корректно.

Конвертер совсем потерял интеллект, даже 1-бит альфа-канала сделать толком не может!!!

Re: JNG Bugs

Posted: 2012-01-02T07:40:50-07:00
by Solovei95
Я прошу убрать релиз Q16 т.к. он баганный...

Re: JNG Bugs

Posted: 2012-01-02T12:24:44-07:00
by glennrp
Solovei95 wrote:Я прошу убрать релиз Q16 т.к. он баганный...
You are asking us to remove the Q16 release because it has an obscure
bug in the JNG format relating to use of "-depth 12" ???

We'll try to fix the bug but I don't think we will be withdrawing the release.

Re: JNG Bugs

Posted: 2012-01-02T13:10:45-07:00
by glennrp
IM-6.7.4-5 (SVN release 6338) won't crash when the encoder receives "-depth 12"

Re: JNG Bugs

Posted: 2012-01-10T00:09:41-07:00
by Solovei95
Я понял в чем баг .bat файлов - когда я использую знак %, то он понимает не правильно. Но когда использую %% то он начинает правильно их понимать!

Re: JNG Bugs

Posted: 2012-01-10T00:13:09-07:00
by Solovei95
И когда ввожу такую команду:
convert img1.png -compress zip -define png:bit-depth=16 -quality 95080 -sampling-factor 4:2:2 -channel A -threshold 99%% img1.jng

То альфа-канал начинает неправильно кодироваться в 16-битном потоке!