bugGNU Octave - Bugs: bug #42834, imread ("default.img")...

 
 

bug #42834: imread ("default.img") returns empty colormap with gm 1.3.16

Submitted by:  Andreas Weber <andy1978>
Submitted on:  Wed 23 Jul 2014 12:21:42 PM UTC  
 
Category: LibrariesSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Regression
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: 3.8.1Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Sat 26 Jul 2014 03:36:28 AM UTC, comment #8:

I grafted the cset back on to the stable branch since this could be considered a regression. See this cset (http://hg.savannah.gnu.org/hgweb/octave/rev/87cba451fd5e).

Rik <rik5>
Project Administrator
Fri 25 Jul 2014 01:40:18 PM UTC, comment #7:

I pushed this cset to the default branch. Should it be merged into stable? In a way, it could be considered a regression.

Carnë Draug <carandraug>
Project Member
Thu 24 Jul 2014 05:53:41 PM UTC, comment #6:

That is an even older so I guess it is safe to assume it fixed it. Andy, please reopen this bug if for some reason does not for you.

Carnë Draug <carandraug>
Project Member
Thu 24 Jul 2014 05:46:27 PM UTC, comment #5:

The patch stops the error message for me with GM 1.3.12.

Rik <rik5>
Project Administrator
Thu 24 Jul 2014 04:45:37 PM UTC, comment #4:

I have, I hope, devised a solution for this. If someone running Octave with GM 1.3.16 or older, could check if the attached cset works, I can push it.

(file #31769)

Carnë Draug <carandraug>
Project Member
Wed 23 Jul 2014 10:36:49 PM UTC, comment #3:

I have already discussed this with Andy on IRC. Basically the problem is on is_indexed function in _magick__read_.cc file

http://hg.savannah.gnu.org/hgweb/octave/file/c6b89c4a9e63/libinterp/dldfcn/__magick_read__.cc#l75

The file is an indexed image but is_indexed() seems to return false when using older version of GraphicsMagick. This is a problematic function because of the reasons listed on the source (basically, GM does not really tells anything about the file, only about how it is stored in memory after reading and optimizing).

GM uses libpng to read png files, so we access it's values directly to really check if the file is indexed. If the value of "color type orig" is 3, it is an indexed image. I do not know why this is failing on older versions of GM but you can check by running the following:

+verbose+
$ gm identify -verbose default.img | grep -P "Class|IHDR"
Class: PseudoClass
Png:IHDR.color-type-orig: 3
Png:IHDR.bit-depth-orig: 8
-verbose-

If you do not have the "Png:IHDR.color-type-orig", then run the command without grepping and look for something similar to it.

The whole point of using GM is ignoring the underlying library that is actually doing the reading. If we have to start checking things like this for every format, then GM starts losing its value (which in my opinion is already quite low for many other reasons I stated in other bug reports and mailing list).

The GraphicsMagick version where this bug appears is still on Debian stable (which we should be supporting). It also did not exist before 3.8 when default.img was not really an image but an Octave data file so it could be considered a regression.

Carnë Draug <carandraug>
Project Member
Wed 23 Jul 2014 09:58:58 PM UTC, comment #2:

I'm adding Carne Draug to the CC list because he has done a lot of the work with GraphicsMagick and the default image.

Rik <rik5>
Project Administrator
Wed 23 Jul 2014 05:11:39 PM UTC, comment #1:

This is because _magick_read_.cc:is_indexed for our "default.img" (md5sum d581bb80374d39ef0994154afc5c1f47)
returns false for graphicsmagick 1.3.16 and true for 1.3.18.

I'll attach a quick test if someone wants to try it out. is_indexed is a direct copy from _magick_read_.cc.

Compile with g++ -Wall $(pkg-config --cflags GraphicsMagick++) main.cc -o isindex $(pkg-config --libs GraphicsMagick++)

(file #31765)

Andreas Weber <andy1978>
Project Member
Wed 23 Jul 2014 12:21:42 PM UTC, original submission:

Debian GNU/Linux 7.5 (wheezy)
libgraphicsmagick++1-dev 1.3.16-1.1
imread("default.img") returns an empty colormap with octave 3.8.1, 3.8.2 or default.

I run this demo yesterday in debian jessie without problems so I guess this depends on the version of GraphicsMagick.

Andreas Weber <andy1978>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #31765:  main.cc added by andy1978 (879B - text/x-c++src - testcase for is_index)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by rik5
  • -unavailable- added by andy1978 (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 26 Jul 2014 03:36:28 AM UTCrik5Item GroupNone=>Regression
    Thu 24 Jul 2014 05:53:41 PM UTCcarandraugStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Thu 24 Jul 2014 04:45:37 PM UTCcarandraugAttached File-=>Added gm-libpng-bug42834.patch, #31769
    Wed 23 Jul 2014 09:58:58 PM UTCrik5Carbon-Copy-=>Added carandraug
    Wed 23 Jul 2014 05:11:39 PM UTCandy1978Attached File-=>Added main.cc, #31765

    Back to the top


    Powered by Savane 3.1-cleanup1