bugGNU Octave - Bugs: bug #45881, Diagonal lines visible in PNG...

 
 

bug #45881: Diagonal lines visible in PNG image created using pcolor

Submitter:  None
Submitted:  Sat 05 Sep 2015 04:58:33 PM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Inaccurate Result
Status:  Fixed Assigned to:  None
Originator Name:  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
   

Jump to the original submission

Mon 14 Nov 2016 02:40:06 PM UTC, comment #6: 

The default ghostscript options for exporting raster figure using print is now to disable antialiasing on graphics (the equivalent of the solution in comment #3).

Closing report.

Pantxo Diribarne <pantxo>
Group Member
Wed 09 Sep 2015 07:09:05 AM UTC, comment #5: 

I think this issue is not related any OpenGL, but Ghostscript related, since going through gnuplot makes the same result, but rectangles instead of triangles. The problem is that Ghostscript is anti-aliasing on each polygon, instead of the entire output image. This results in ugly artificial boundary conditions.

Even though this particular bug belongs to Ghostscript, Octave still needs internal print functionality to properly images with different shadings (or, is it possible to use smooth shading in postscript?)

Anonymous
Sun 06 Sep 2015 09:36:02 AM UTC, comment #4: 

If you only want a rasterized version of the image, I must agree that using the current export functionality, which is based on vecorized intermediate results, is not ideal.

Direct rendering is possible with the internal function _osmesa_print_ (in Octave >= 4.0.0), which basically makes a “screenshot” of the OpenGL scene. Note that the image must be invisible for that purpose and the function is known to crash on NVIDIA chipsets.

The interval package contains a simple wrapper function _print_mesa_ that you could use. It adds anti-aliasing to the image and respects the figure's papersize for export. I use it instead of “print” to export raster graphics for the interval package's manual, because the described problem gets even worse in 3D rendering, see bug #45137.

Oliver Heimlich <oheim>
Sun 06 Sep 2015 09:03:05 AM UTC, comment #3: 

This is a ghostscript wrapper that solves the problem


#!/bin/bash

ARGS=()
ARGS+=("-dGraphicsAlphaBits=1")
for var in "$@"; do
        [ "$var" != '-dGraphicsAlphaBits=4' ] && ARGS+=("$var")
done
gs "${ARGS[@]}"


It basically turns of anti-aliasing for graphics but it is a hack. It should also be added that the gnuplot backend is also affected.

This bug is similar to the infamous `sound` bug. The bug here is that ghostscript cannot be used to rasterize the vector graphics. With the MESA support in 4.0, it is perhaps possible to render to a file directly, without an external program.

Anonymous
Sun 06 Sep 2015 07:20:12 AM UTC, comment #2: 

It is sort of a duplicate of #44181, and for vector graphics, the bug is present in Matlab as well. But I export to raster graphics, and we do not need to use gs as external rasterizer.

Anonymous
Sat 05 Sep 2015 06:02:22 PM UTC, comment #1: 

This is a duplicate of bug #44181.

Oliver Heimlich <oheim>
Sat 05 Sep 2015 04:58:33 PM UTC, original submission:  


h=pcolor(rand(16));
set(h,'EdgeColor','none');
colormap(gray(256));
print('test.png','-dpng','-r600');


Actually, you do not need to set colormap, but it makes the issue more visible.

Since I need to get rid of them quickly I also ask for a different solution. I use pcolor since I want logarithmic x- and y-axis. I can apply a median filter afterwards, but that requires horrible amount of RAM since my grid is fine-grained. Since it appears that Octave does it through gs,


gs --version


gives me 9.10

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #34816:  test.png added by None (332KiB - image/png)

 

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 oheim (Posted a comment)
  •  

    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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-11-14 pantxo StatusNone Fixed
        Open/ClosedOpen Closed
    2015-09-05 None Attached File- Added test.png, #34816

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code