bugGNU Octave - Bugs: bug #52866, print() function doesn't accept...

 
 

bug #52866: print() function doesn't accept '-RGBImage' option

Submitted by:  Thomas Aiman <thomasaiman>
Submitted on:  Thu 11 Jan 2018 11:27:29 PM UTC  
 
Category: Octave FunctionSeverity: 1 - Wish
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: Patch SubmittedAssigned to: None
Originator Name: Open/Closed: Open
Release: devOperating 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)

Fri 02 Mar 2018 02:27:06 PM UTC, comment #6:

I attached a cset in which I implemented "-opengl", "-painters" and "-RGBImage". The "opengl" printing engine uses getframe to produce pixels directly. It is the default for raster formats supported by "imwrite" and doesn't work at all for vector formats.

To have it work quite correctly, I had to scale fixed size objects (text and line width). All this part of the code will be obsoleted and done more accurately when bug #49053 is fixed: the n pixels distance between tick labels and axes can't be scaled from the interpreter.

(file #43437)

Pantxo Diribarne <pantxo>
Project Member
Fri 02 Feb 2018 09:07:27 AM UTC, comment #5:

PS: I imagine resolution depends on screen DPI, so to complement the previous response:

which explains:

Amro <amro_octave>
Tue 30 Jan 2018 12:58:36 AM UTC, comment #4:

@Pantxo: The future of Octave's plotting and printing engine is OpenGL and Qt. Thus, if you have to ditch support for gnuplot I'm not that concerned. Changing the release to 'dev'.

Rik <rik5>
Project Administrator
Mon 15 Jan 2018 04:07:00 PM UTC, comment #3:

I ran this in MATLAB:

size(a) = [875, 1167, 3]
class(a) = 'uint8'
size(b) = [1750, 2333, 3]
class(b) = 'uint8'
imwrite outputs are attached.

(file #42915, file #42916)

Thomas Aiman <thomasaiman>
Sun 14 Jan 2018 09:49:54 AM UTC, comment #2:

This could be implemented in two ways:

  • use a print command to produce a PNG temporary file and use imread to get the pixel data (slow, works for both gnuplot and opengl)
  • prepare the figure for printing and use "getframe" instead of _opengl_print_ (fast, opengl only). In order to honor the resolution we can probably use interp2 afterwards.

What do those commands return in Matlab:

Pantxo Diribarne <pantxo>
Project Member
Thu 11 Jan 2018 11:38:41 PM UTC, comment #1:

Confirmed. This is a relatively new option which explains why it is unsupported. I've made this a wish list item to implement.

Rik <rik5>
Project Administrator
Thu 11 Jan 2018 11:27:29 PM UTC, original submission:

From the MATLAB documentation:
https://www.mathworks.com/help/matlab/ref/print.html

cdata = print('-RGBImage'); returns the RGB image data for the current figure. This option differs from screen captures in that all printing features apply to the output. You can also specify the resolution, renderer, '-noui', and fig options with this syntax. However, you cannot specify a Simulink block diagram.

A simple example that works in MATLAB:

Octave returns the following error:

Thomas Aiman <thomasaiman>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #43437:  opengl_print_raster.patch added by pantxo (22KiB - text/x-patch)
file #42915:  r200.png added by thomasaiman (23KiB - image/png)
file #42916:  r400.png added by thomasaiman (60KiB - image/png)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by amro_octave (Posted a comment)
  • -unavailable- added by pantxo (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by thomasaiman (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 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 02 Mar 2018 02:27:06 PM UTCpantxoAttached File-=>Added opengl_print_raster.patch, #43437
      StatusConfirmed=>Patch Submitted
    Tue 30 Jan 2018 12:58:36 AM UTCrik5Release4.2.1=>dev
    Mon 15 Jan 2018 04:07:00 PM UTCthomasaimanAttached File-=>Added r200.png, #42915
      Attached File-=>Added r400.png, #42916
    Thu 11 Jan 2018 11:38:41 PM UTCrik5Severity3 - Normal=>1 - Wish
      StatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup1