[chimerax-users] Image saving/exporting options
Tom Goddard
goddard at sonic.net
Thu Feb 16 10:16:26 PST 2023
Hi Tony,
Thanks for showing those cool SVG graphics. Three dimensional surfaces are often composed of triangles. Although SVG can make the edges sharp, then you start seeing the individual triangles if the lighting across each triangle is not perfectly done. My previous explanation was over-simplified -- an SVG shape does not have to be a single color, you can put color gradients across it. In Avogadro output it probably puts a color gradient on each triangle interpolating the triangle corner colors. That kind of interpolation is called "per-vertex coloring". But in a 3D graphics app it often uses "per-pixel coloring" where the lighting is computed at each pixel instead of at each triangle vertex. That produces smoother looking lighting when the triangles are bigger than a few pixels. ChimeraX always uses per-pixel lighting.
Tom
> On Feb 16, 2023, at 1:15 AM, Tony Schaefer via ChimeraX-users <chimerax-users at cgl.ucsf.edu> wrote:
>
> Tom and Matthew,
>
> Avogadro can technically export images in vector graphics format.
>
> I don't know exactly how Avogadro makes SVGs, but it looks like they project the triangles that make up the objects onto a plane, and somehow determine how to color individual triangles. The lighting looks off - it's not quite what Avogadro shows in its GUI. Also, you can still see the triangles in the SVG image. I've attached a screenshot of an SVG as an example (the SVG is several megabytes). You'll have to take my word for it - if you zoom in on the SVG, those triangles stay crisp 🙃.
>
> Avogadro can also export PDFs. The PDF does not have obvious triangles like the SVG, and you can zoom in as far as you like. In my opinion, the PDF looks better but the colors still differ from what Avogadro shows in its graphics window. It's probably difficult to get the lighting/shading to match. The PDF is much smaller than the SVG in terms of file size.
>
> I think PNGs usually look pretty good, even if you can't zoom in on them infinitely. If you're zoomed in to a distance label to the point where it's too pixelated, you probably can't see the atoms you're measuring the distance between. Saving images with 3x supersampling in ChimeraX pretty much always looks fine to me, but opinions may vary.
>
> Best,
>
> Tony
>
> On Wed, Feb 15, 2023 at 11:03 PM Matthew Graneri via ChimeraX-users <chimerax-users at cgl.ucsf.edu <mailto:chimerax-users at cgl.ucsf.edu>> wrote:
>> Hi Tom,
>>
>> Thanks for that - the tip about the label resolution fixed the issue.
>>
>> Ah, that makes sense! I assumed you could apply a colour gradient to the vectors, but the vector images I had in my head were of graphs (single coloured lines) and Avogadro molecules (where the colour gradient can look a little odd). Thanks for the info :)
>>
>> Regards,
>>
>> Matthew
>>
>>> On 16 Feb 2023, at 2:21 am, Tom Goddard <goddard at sonic.net <mailto:goddard at sonic.net>> wrote:
>>>
>>> Hi Matthew,
>>>
>>> The distance text label in your image is pixelated because its quality does not automatically adjust when saving higher resolution images. This is a limitation of ChimeraX. But you can increase the quality of the text labels using the "size" option of the label command
>>>
>>> label size 200
>>>
>>> The value is the height in pixels of the rasterized label text. The default is 48 pixels.
>>>
>>> Vector graphics are generally made up of single color shapes defined by equations (e.g. circles or splines). ChimeraX renders 3D graphics, so the shapes have no simple equations for the boundaries seen in a 2D image and also they are almost never single color because the 3D lighting varies the brightness even across a single atom. This is why you don't see any software producing vector graphics for 3D renderings. You are right vector graphics can produce small file sizes, but it only works for 2D single color shapes.
>>>
>>> Tom
>>>
>>>
>>>> On Feb 15, 2023, at 12:20 AM, Matthew Graneri via ChimeraX-users <chimerax-users at cgl.ucsf.edu <mailto:chimerax-users at cgl.ucsf.edu>> wrote:
>>>>
>>>> Hi Elaine,
>>>>
>>>> That’s fair enough. You’re absolutely right - journals always seem to want tiff files (I cannot figure out why, though).
>>>>
>>>> I tried your suggestion, though, and while it kind of worked, there was a weird effect with the text in the saved image - for some reason, the text appears to be a significantly lower resolution to the rest of the image (I’ll attach a screenshot below). Do you have any idea why this might be happening?
>>>>
>>>> Also, just an FYI, the reason I like PDFs is because they use vector graphics. The way it was explained to me is that vector graphics make an image out of a set of mathematical functions, which means you can expand them to whatever size you like and they will maintain their resolution (a circle is always going to be round), to a point, at least. PNGs, JPEGs and TIFFs are bitmap images, which means they are made of an array of pixels, so, when you enlarge an image, the pixels simply expand (circles become a series of squares). It also means that the higher the resolution, the larger the file (whereas the number of functions in a PDF file remains constant). While this might sound like a trivial difference, when you’re writing a thesis in word, or compiling one in LaTeX, it can mean the difference between a 30 MB file or a 150 MB file.
>>>>
>>>> After a quick look, it seems like you can’t actually save images as vector graphics in ChimeraX. Is there a reason for that, or is it just chance? (Not criticising! Just curious.)
>>>>
>>>> Regards,
>>>>
>>>> Matthew
>>>>
>>>> <Screenshot 2023-02-15 at 4.07.27 pm.png>
>>>>
>>>>> On 15 Feb 2023, at 12:45 am, Elaine Meng <meng at cgl.ucsf.edu <mailto:meng at cgl.ucsf.edu>> wrote:
>>>>>
>>>>> Hi Matthew,
>>>>> There is no option in distance units like inches/centimers but you can specify a high resolution by specifying a high number of pixels. E.g. if you want the image to be 2 inches wide at 600 dpi then you need the image to be 1200 pixels wide. The file would not be marked with the 2 inches width, but you could set that in some separate image-editing application.
>>>>>
>>>>> There is no option to save PDF of the graphics window. It will not really save you in file size anyway when the contents include an image like a photo or molecular graphics. The PDF will be just as big as the resolution of the image requires.
>>>>>
>>>>> The filesize/resolution tradeoff is different for different image formats, and there are various types of compression available, and some formats are "lossless" and others are not. I'm not an expert on the details. I use TIFF and PNG when I want lossless (and those are the ones journals usually want), JPG if I'm willing to lower the quality.
>>>>>
>>>>> I hope this helps,
>>>>> Elaine
>>>>> -----
>>>>> Elaine C. Meng, Ph.D.
>>>>> UCSF Chimera(X) team
>>>>> Department of Pharmaceutical Chemistry
>>>>> University of California, San Francisco
>>>>>
>>>>>
>>>>>> On Feb 13, 2023, at 8:15 PM, Matthew Graneri via ChimeraX-users <chimerax-users at cgl.ucsf.edu <mailto:chimerax-users at cgl.ucsf.edu>> wrote:
>>>>>>
>>>>>> Hi there,
>>>>>> I was wondering if there was an option to set the resolution of an image you want to export? In the older Chimera application, there were many more options open to you when you wanted to save an image (I’ve attached a screenshot of the old and new image saving screens for comparison). If not, is there any chance of implementing a resolution specification option sometime in the future?
>>>>>>
>>>>>> I was also wondering if it was possible to save images from ChimeraX as PDF files? I find that they usually maintain a high resolution without being particularly big, in terms of memory.
>>>>>>
>>>>>> Apart from that, really enjoying ChimeraX!
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Matthew
>>>>>
>>>>
>>>> _______________________________________________
>>>> ChimeraX-users mailing list
>>>> ChimeraX-users at cgl.ucsf.edu <mailto:ChimeraX-users at cgl.ucsf.edu>
>>>> Manage subscription:
>>>> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
>>>
>> _______________________________________________
>> ChimeraX-users mailing list
>> ChimeraX-users at cgl.ucsf.edu <mailto:ChimeraX-users at cgl.ucsf.edu>
>> Manage subscription:
>> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
> <Screenshot 2023-02-16 005332.png><test_methane.pdf>_______________________________________________
> ChimeraX-users mailing list
> ChimeraX-users at cgl.ucsf.edu
> Manage subscription:
> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.rbvi.ucsf.edu/pipermail/chimerax-users/attachments/20230216/40b30ce5/attachment.html>
More information about the ChimeraX-users
mailing list