[gradsusr] colored polygons in images

Jennifer Adams jma at cola.iges.org
Thu Jan 20 10:15:00 EST 2011


Two factors are important: the size of your output image, and the  
order in which the colored polygons and black outlines are drawn.

The page coordinates of the polygons and lines (in 11x8.5 space) are  
converted to integer-valued pixel coordinates and drawn accordingly.  
The bigger the image, the more precision you'll get in that conversion  
and the better your image will look.

The second factor is probably more important -- the graphical elements  
are rendered to the output image in the same order that they are drawn  
to the screen. If your cbar.gs scripts draws the ladder of black  
outlines first, then overlays the color polygons, the polygons may  
cover the outlines if the image resolution is not sufficiently high to  
resolve the difference in the page coordinates between the outlines  
and the colored polygons. And it may be that the page coordinates of  
the outlines and polygons are the same, in which case what you draw  
first will be buried by what you draw second.

Try a test with just a filled rectangle and its outline, then use  
printim with a 110x850 image and 1100x850 and you'll see how these two  
factors come into play. How it looks in the display window, and how it  
looks in the printim output may not be exactly the same. That is  
because the display window is drawn with X11 library, and printim uses  
the gd library to render the image. Your version of cbar.gs may need  
some revision to draw the outlines on top of the colored polygons.
--Jennifer

On Jan 15, 2011, at 4:34 PM, Jeffrey Duda wrote:

> Grads users,
> I hadn't heard a response on this issue and it's been awhile.  I was  
> wondering if anyone else has noticed this or knows why it's  
> happening and/or how to stop it.  Thank you.
>
> Jeff Duda
>
> On Thu, Dec 16, 2010 at 1:38 PM, Jeffrey Duda <jdduda at iastate.edu>  
> wrote:
> Hello,
> I keep seeing strange things when I try to plot a colored filled  
> polygon and then save the image, in particular within a colorbar.   
> I'm using the color bar script provided in the scripting library  
> page, cbar.gs.  The retangles always seem to "bleed" over the top  
> line of the colorbar (seen only in horizontal color bars).  The  
> original script doesn't have a black outline drawn on the top of a  
> horizontal color bar (well it does, but it is covered up by the  
> filled colored polygons).  I thought that made the color bar look  
> tacky, which is why I modified the script ever so slightly to get  
> that top line to appear.  As an example, I've attached 3 images all  
> of the same data, but presented in different ways to show how the  
> color bar acts.
>
> grads.png is a screenshot of my grads window (using the print screen  
> key) showing the color bar appearing correctly as I want it to.
>
> 2.gif was obtained by issuing the command "printim 2.gif" using the  
> same image as is shown in grads.png
>
> 3.gif is the same thing as 2.gif only sized as 5000 x 5000 pixels.   
> It shows the overlap is still there, but to much less of an extent  
> relative to the size of the image.  This makes me wonder that the  
> overlap is some default like "1 pixel greater no matter what the  
> size" so that it doesn't show up as well for larger images.
>
> Can someone explain to me this behavior and how to keep the color  
> bar colors from overlapping the top line of the color bar in printed  
> images that are obtained using printim?  Thanks.
>
> Jeff Duda
>
> -- 
> Jeff Duda
> Iowa State University
> Meteorology Graduate Student
> 3134 Agronomy Hall
> www.meteor.iastate.edu/~jdduda
>
>
>
> -- 
> Jeff Duda
> Iowa State University
> Meteorology Graduate Student
> 3134 Agronomy Hall
> www.meteor.iastate.edu/~jdduda
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr

--
Jennifer M. Adams
IGES/COLA
4041 Powder Mill Road, Suite 302
Calverton, MD 20705
jma at cola.iges.org



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20110120/2a452193/attachment-0003.html 


More information about the gradsusr mailing list