There is a bug report about this issue in our (IDL-69556). Hopefully, it will be fixed in a future version of IDL. A possible workaround is to use the COPYWINDOW method, display the image in a new window and then save the contents of the new window as a PDF.
dat2 = findgen(500,500)
dat2[100:200,100:200] = !values.F_NAN
w = window(dimensions=[500,500])
i2 = image(data, RGB_TABLE=33, MARGIN=0, /CURRENT)
new_image = i2.CopyWindow(HEIGHT=500,WIDTH=500)
i3 = image(new_image)
i3.save, "test.pdf"
|