bugGNU Octave - Bugs: bug #52306, Cannot set figure background color...

 
 

bug #52306: Cannot set figure background color when print()ing to an image file

Submitter:  Etienne Dechamps <edechamps>
Submitted:  Sun 29 Oct 2017 07:09:58 PM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Invalid / Not an Octave Bug Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 4.2.1 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 29 Oct 2017 11:57:45 PM UTC, comment #1: 

By default (and it is Matlab compatible) the background color of figures is set white when printing. To change this behavior you need to  set the figure "InvertHardcopy" to "off":


fplot(@(x) sin(x), [0 2*pi])
set(gcf(), 'Color', [1 0 0], "InvertHardcopy", "off")
print('foo.jpg', '-djpg')


See "doc ('figure inverthardcopy')".

Closing report.

Pantxo Diribarne <pantxo>
Group Member
Sun 29 Oct 2017 07:09:58 PM UTC, original submission:  

On Debian Sid, octave 4.2.1-4+b1:


graphics_toolkit('fltk')
fplot(@(x) sin(x), [0 2*pi])
set(gcf(), 'Color', [1 0 0])
print('foo.jpg', '-djpg')


Expected result: foo.jpg contains a red background.

Actual result: foo.jpg contains a white background.

Additional information:

- In the window output the background color is correct. It's only wrong in the resulting image file.

- This affects at least JPG, PNG, and SVG output. I have not tested others.

Etienne Dechamps <edechamps>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by edechamps (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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-10-29 pantxo StatusNone Invalid / Not an Octave Bug
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code