bugGNU Octave - Bugs: bug #42107, Image colors are inverted when...

 
 

bug #42107: Image colors are inverted when printing a plot to a file with FLTK

Submitter:  None
Submitted:  Sun 13 Apr 2014 12:09:42 PM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Andrea Lazzarotto Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.8.1
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 18 Apr 2014 05:13:34 PM UTC, comment #4: 

This was a problem with gl2ps which only accepts float inputs.  Octave has to convert image formats, like uint8, to float before it delivers it to gl2ps and gl2ps wanted a different conversion than what we were doing.

I fixed it in this changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/3277514f36da).  It will be a part of the next bug fix release 3.8.2.

Rik <rik5>
Group administrator
Sun 13 Apr 2014 06:29:08 PM UTC, comment #3: 

The problem is that the colors are being inverted.  Rnew = 1 - Rold, Gnew = 1 - Gold, Bnew = 1 - Bold.  Interestingly, this problem does not occur for indexed images.  The following code works.


img = imread ("rainbow.jpg");
[img2, map] = rgb2ind (img);
imshow (img2, map);
print -djpg test.jpg



Rik <rik5>
Group administrator
Sun 13 Apr 2014 04:20:43 PM UTC, comment #2: 

With some more testing, I've found that this problem occurs for images with many different output formats (jpg, png, pdf, eps).  It also does not depend on the overlay.  The following is enough to demonstrate the bug.


imshow ("rainbow.jpg")
print -djpg test.jpg


Octave is probably invoking the gl2ps library incorrectly.

Rik <rik5>
Group administrator
Sun 13 Apr 2014 04:02:53 PM UTC, comment #1: 

Confirmed.  This bug is present in all major branches that I tested including 3.4.X, 3.6.X, 3.8.X, and the development branch.

Rik <rik5>
Group administrator
Sun 13 Apr 2014 12:09:42 PM UTC, original submission:  

The attached example contains code which:

  1. shows a picture with imshow
  2. plots some data over it in blue
  3. displays the figure
  4. saves the figure to a file
  5. repeats the steps with GNUPlot


The figure display correctly on video, while the resulting output picture has a "correct" blue line, but inverted colors. This happens only with FLTK on my machine.

Expected result: I would expect to get a printed picture with correct colors, like GNUPlot does.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #31160:  code.m added by None (310B - text/x-objcsrc)
file #31161:  rainbow.jpg added by None (19KiB - image/jpeg)
file #31162:  output_fltk.jpg added by None (44KiB - image/jpeg)
file #31163:  output_gnuplot.jpg added by None (42KiB - image/jpeg)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-04-18 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2014-04-13 rik5 StatusNone Confirmed
    2014-04-13 None Attached File- Added code.m, #31160
        Attached File- Added rainbow.jpg, #31161
        Attached File- Added output_fltk.jpg, #31162
        Attached File- Added output_gnuplot.jpg, #31163

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code