In a previous post we managed to get PDF output right for publication sized figures. Now I am having problems with PDF output when mixing vector (i.e. color bars, lines and text) and raster (i.e. low resolution images) content. In the example below I create a low resolution image (10x10) and save it to PDF output. I used 10x10 to show that some form of antialiasing is running amok when the image content is rasterized while saving to PDF. I don't know why it is so heavily antialiased, the image resolution looks well below screen DPI. I haven't found any way to control this in the documentation short of setting all the PDF output to bitmap (which will rasterize the vector content as well). What I'm looking for is being able to set the image content to a high DPI (such is 600) and/or not include any antialiasing, while also having vector content on the page.
10x10 is an extreme case, but I work with climate model data, so I'd really like to see crisp edges on low resolution image data.
Thanks
pro pdf_output_example_with_raster_image
;-----publication size requirements------
mm2inches = 0.0393701
mm2point = 2.83464567
screenDPI = 72
figWidthPx = 190 * mm2inches * screenDPI ;mm->px
figWidthCm = 190 * 0.1 ;mm->cm
figHeightPx = 140 * mm2inches * screenDPI ;mm->px
figHeightCm = 140 * 0.1 ;mm->cm
;----------------------------------------
w = window(DIMENSIONS=[figWidthPx,figHeightPx], BUFFER=1)
data = RANDOMU(0, 10,10)
img = image(data, RGB_TABLE=70, POSITION=[0.1,0.25,0.9,0.9], /current)
;draw frame around image
xrange = img.XRANGE
yrange = img.YRANGE
xcoords = [xrange[0], xrange[0],xrange[1],xrange[1], xrange[0]]
ycoords = [yrange[0], yrange[1],yrange[1],yrange[0], yrange[0]]
box = POLYLINE(xcoords, ycoords, /data)
;add colorbar
cb1 = COLORBAR(POSITION=[0.2, 0.1, 0.8, 0.2], TARGET=img, BORDER=1)
;image content will be very blurry
w.save, '~/Desktop/publication_vector_output_with_raster.pdf',/CENTIMETERS,page_size=[figWidthCm, figHeightCm], $
xmargin=0, ymargin=0, height=figHeightCm
;image looks good, but all vector content has been rasterized
w.save, '~/Desktop/publication_vector_output_with_raster_bitmap.pdf',/CENTIMETERS,page_size=[figWidthCm, figHeightCm], $
xmargin=0, ymargin=0, height=figHeightCm, bitmap=1, resolution=600
w.close
end
|