[Scilab-users] exporting Matplot RGB image to vector formats : BUG ?

classic Classic list List threaded Threaded
4 messages Options
Antoine Monmayrant Antoine Monmayrant
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] exporting Matplot RGB image to vector formats : BUG ?

Hi all,


It seems there is a bug in the export of graphics to vector formats (svg, pdf, ps): it fails for elements in your graphic windows that were generated using Matplot on an RGB hypermatrix:

////////////////////////////////////////////////////////////////////////////////////////////////////

img(:,:,1)=[ 1 0 0 ; 0 1 0 ; 0 0 1]*255;
img(:,:,2)=[ 0 0 1 ; 0 1 0 ; 1 0 0]*255;
img(:,:,3)=[ 0 1 0 ; 0 1 0 ; 0 1 0]*255;

h=scf();
Matplot(img);

xs2png(h,"img.png"); // correct
xs2svg(h,"img.svg"); // wrong
xs2pdf(h,"img.pdf"); // wrong again
xs2ps(h,"img.ps"); // wrong again

////////////////////////////////////////////////////////////////////////////////////////////////////

I've reported it: http://bugzilla.scilab.org/show_bug.cgi?id=16447

Do any of you know a workaround to avoid this bug?
On more complex RGB images then the small example above, the RGB image is not rendered at all (just white emptiness)...
I really need to export to svg to produce publication quality graphics and I have a bunch of bitmap+line plots on top of them...

Thanks for you help,


Antoine


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: exporting Matplot RGB image to vector formats : BUG ?

Hello Antoine,

Just add
gce().image_type = "rgba";

immediately after the Matplot() instruction
, without adding a fourth layer to gce().data.
This makes the three .svg .pdf and .ps conversions working.

Best regards.
Samuel

Le 27/05/2020 à 08:58, Antoine Monmayrant a écrit :

Hi all,


It seems there is a bug in the export of graphics to vector formats (svg, pdf, ps): it fails for elements in your graphic windows that were generated using Matplot on an RGB hypermatrix:

////////////////////////////////////////////////////////////////////////////////////////////////////

img(:,:,1)=[ 1 0 0 ; 0 1 0 ; 0 0 1]*255;
img(:,:,2)=[ 0 0 1 ; 0 1 0 ; 1 0 0]*255;
img(:,:,3)=[ 0 1 0 ; 0 1 0 ; 0 1 0]*255;

h=scf();
Matplot(img);

xs2png(h,"img.png"); // correct
xs2svg(h,"img.svg"); // wrong
xs2pdf(h,"img.pdf"); // wrong again
xs2ps(h,"img.ps"); // wrong again

////////////////////////////////////////////////////////////////////////////////////////////////////



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Antoine Monmayrant Antoine Monmayrant
Reply | Threaded
Open this post in threaded view
|

Re: exporting Matplot RGB image to vector formats : BUG ?

Yep, I've just seen your message on bugzilla.
I confirm it solves the problem on my mwe.
I'll try to use it on maximum-nonworking-example today.

Thanks!

Antoine

On 28/05/2020 00:37, Samuel Gougeon wrote:
Hello Antoine,

Just add
gce().image_type = "rgba";

immediately after the Matplot() instruction
, without adding a fourth layer to gce().data.
This makes the three .svg .pdf and .ps conversions working.

Best regards.
Samuel

Le 27/05/2020 à 08:58, Antoine Monmayrant a écrit :

Hi all,


It seems there is a bug in the export of graphics to vector formats (svg, pdf, ps): it fails for elements in your graphic windows that were generated using Matplot on an RGB hypermatrix:

////////////////////////////////////////////////////////////////////////////////////////////////////

img(:,:,1)=[ 1 0 0 ; 0 1 0 ; 0 0 1]*255;
img(:,:,2)=[ 0 0 1 ; 0 1 0 ; 1 0 0]*255;
img(:,:,3)=[ 0 1 0 ; 0 1 0 ; 0 1 0]*255;

h=scf();
Matplot(img);

xs2png(h,"img.png"); // correct
xs2svg(h,"img.svg"); // wrong
xs2pdf(h,"img.pdf"); // wrong again
xs2ps(h,"img.ps"); // wrong again

////////////////////////////////////////////////////////////////////////////////////////////////////



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Antoine Monmayrant Antoine Monmayrant
Reply | Threaded
Open this post in threaded view
|

Re: exporting Matplot RGB image to vector formats : BUG ?

In reply to this post by Samuel GOUGEON

OK, just tested on my real plot: it does work!
Samuel: how did you come up with this fix?

Antoine

On 28/05/2020 00:37, Samuel Gougeon wrote:
Hello Antoine,

Just add
gce().image_type = "rgba";

immediately after the Matplot() instruction
, without adding a fourth layer to gce().data.
This makes the three .svg .pdf and .ps conversions working.

Best regards.
Samuel

Le 27/05/2020 à 08:58, Antoine Monmayrant a écrit :

Hi all,


It seems there is a bug in the export of graphics to vector formats (svg, pdf, ps): it fails for elements in your graphic windows that were generated using Matplot on an RGB hypermatrix:

////////////////////////////////////////////////////////////////////////////////////////////////////

img(:,:,1)=[ 1 0 0 ; 0 1 0 ; 0 0 1]*255;
img(:,:,2)=[ 0 0 1 ; 0 1 0 ; 1 0 0]*255;
img(:,:,3)=[ 0 1 0 ; 0 1 0 ; 0 1 0]*255;

h=scf();
Matplot(img);

xs2png(h,"img.png"); // correct
xs2svg(h,"img.svg"); // wrong
xs2pdf(h,"img.pdf"); // wrong again
xs2ps(h,"img.ps"); // wrong again

////////////////////////////////////////////////////////////////////////////////////////////////////



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users