How to save a high-resolution figure in MATLAB - image

When I save a figure from MATALB, I'd like the resulting image to have very high resolution so that I can zoom in to see detail in the image. When I use 'File --> Save As' on a figure, the image is not high resolution.
How can I save a figure to a high resolution image in MATLAB?

You can specify a desired resolution to save the image, either from the command line or from the File menu.
Command line:
Using print, just include the option -r###, where ### if the resolution you want. Usually 300 dots-per-inch (dpi) is plenty high enough resolution for my purposes, but feel free to go higher if needed. Obviously the higher the dpi the larger the image file size will be.
print(gcf,'foo.png','-dpng','-r300'); *// 300 dpi
Check out the MATLAB print documentation to see all the print options you can adjust like this.
File menu: Or using 'File -> Export Setup...', on the left select 'Rendering', then adjust the 'Resolution (dpi)'. By default it set to 'auto'.
As with the command line, there are many printing options you can adjust in the File menu. Once you've tinkered a little bit and gotten everything how you want it, you can save the current export settings as default so you don't have to do it every time you save a figure. This is done on the bottom of the same menu 'Export Styles --> Save as style named:' --> choose "default" and click 'Save'.
Here are some more good tips for saving nice figures in MATLAB:

Related

Icons in setting menu may have unexpected vertical lines

We are running cobalt with openGL enabled, and the graphics appear to display correctly under 1920x1080 resolution.
But once in a while, some icons in the "Settings" menu may have unexpected vertical lines on top (as shown in the picture).
We are guessing the icons are created from TTF font file, but we are not sure how it is rendering onto the screen.
We want to dump the icons to file at the following points to check what went wrong.
When the icon is actually converted to image.
When the icon experience further modification. (eg, color change, bolding, etc)
When the icons are rendered onto screen canvas.
Would really appreciate if someone can help to point out where in source code these events may be happening.
I guess the first question is: are you running the stable branch or the experimental branch of Cobalt?
Beyond that, yes, the icons are created from a TTF font file that is downloaded remotely. The icon itself is simply a character that is converted into a glyph, like the text above it, albeit at a much larger size.
I believe that the logic that you're looking for is within RenderText() in cobalt/renderer/rasterizer/skia/render_tree_node_visitor.cc. SkCanvas::drawTextBlob() is passed the glyph and color information that it uses to render the icon.
The specific glyph that is being used looks correct, but the location where the render_tree::GlyphBuffer representing it is created is TextShaper::CreateGlyphBuffer() in cobalt/renderer/rasterizer/skia/text_shaper.cc.

Paraview 3.98.1 settings

I am using Paraview 3.98.1 for picture generation.
I have a python script which calls paraview to generate pictures.
The problem is that whenever the python script calls paraview, paraview opens only in a small screen and not in a full screen mode. This creates bad pictures.
I tried to change the settings in Edit-settings by disabling the splash screen so that i can get paraview in full screen mode. But everytime i close and open paraview the settings are reset.
I am also attaching a screen shot for better understanding.This is what i get when i open.
This is what i need when i open
anyone knows a solution for this?
To increase the size of the pictures one can modify the size of the render window, or export the pictures with a magnification factor > 1.
Here is the python commands to modify the size of the render window :
GetActiveView().ViewSize = [2000, 1500]
If you export the picture with SaveScreenshot, you can set a magnification factor > 1 by adding the magnification parameter (integer value). The picture size will then be the ViewSize multiplied by this factor.

Any CLI tool to perform 3d texture mapping on the fly

I'm currently looking for a way to create a 'configurator' for a upholsters, similar to http://digitaldraping.com/configurator/furniture-sofa/?Cushions_Plain-Cream.png,Sofa_Stripe-Orange.png - you select your fabrics and they are 'drawn' on the sofa automatically.
Unfortunately, all the sites I've looked at seem to use pre-rendered transparent PNGs that are overlaid over each other to build up the full picture. The problem here is that we've figured out that we'd require over 120,000 different images to cover all models, fabrics etc!!
I've looked at a few 3d texture tools such as http://www.arahne.si/products/arah-drape.html, hoping that one of them would have a CLI option where you give it a pre-created wireframe, and a fabric to overlay, and it generates the required image on the fly, but so far everything seems to require real-time use of the GUI to use it.
So, is there a CLI tool that would do what I'm after, or can anyone suggest a way to manipulate the GUI automatically? (from a tech point of view, I'm comfortable with C, Bash, Python or PHP as a solution!)
Thanks!
ArahDrape 2.2 can now work from a command line without any GUI interface. You can also call ArahDrape as a C library. In this way, it can be used in a web server to create texture mapped images on the fly. The command line options are explained below.
ArahDrape 2.2j command line version, ©2015 Arahne
usage:
adCommand -o /tmp/outputImage.png -tN /home/user/texture.png [-hidemodel] [-divide 2] [-filterPNG] [-compressPNG 2] [-m /home/user/model.png] -owner name -activation 174b3cfb49e9 /home/user/project.drape
Input and output images can have png, .tif or .jpg extensions
-o output_image_file
-tN texture_image_file [N goes from 0 to 199]
-hidemodel will render all areas not in region as white
-divide N [N goes from 2 to 5] divide resulting image pixel size
-filterPNG if you do not filter it, rendering is faster
-compressPNG N [N goes from 0 to 9] lower number saves faster, but bigger files
-m model_image_file use this if you want to replace model image from the project; must have same pixel size
-owner owner_name pass the given owner name
-activation activation_code pass the given activation code
last parameter should be ArahDrape project file
All files should be entered with full path.
If you need spaces in filenames, use quotes "" around the filename.
If you provide only Owner name, without activation code, program returns registration code.
ArahDrape supports batch export.
Open ArahDrape project, click on texture you wish to replace, put all your texture in a directory, select from menu
Textures > Browse textures, and as you click the texture to load it, program will save the draped picture. If you have thousands of images, use keyboard shortcut = and program will automatically do them all.
Alpha channel transparency is supported in loading model images or textures, and saving the draped images, as long as you use PNG or TIFF.
Please check this video to see how
ArahDrape works in batch mode.
we (http://digitaldraping.com/) can do just what you are asking. We have two options creating images and rendering a meshed image on the fly. Just get in touch if you still need this solution.

Reduce size of a .png image without losing transparency

Basically, I'd like to resize or resample a .png image (in order to reduce its file size) and yet retain it's transparency.
Anybody got an idea how best to go about this?
Thanks.
You can use paint.net, it is a free tool. Although it is pretty basic, it does the job.
Go to Image > Resize
Stumbled upon this thread and found the following site that does exactly what is requested: https://onlinepngtools.com/resize-png
What graphics program are you using?
Photoshop does this by simply going thru IMAGE > IMAGE SIZE and resizing. Transparency is not affected.
I'm sure Paint Shop Pro does the same
I know this is an old question, but the answer that worked for me was to use Inkscape.
Start Inkscape (free on Inkscape.org).
File -> Import... (Ctrl+I) the PNG file you want to resize (defaults on import dialog are ok).
With the image you just imported selected, select File -> Export PNG image... (Shift+Ctrl+E)
In the Export PNG Image tool pane, click the Export As... button to set the output filename and location.
In this same tool pane, set the image size using width/height or pixels.
In this same tool pane, click the Export button to create the output file.
This worked for me, hope it helps someone else.
Providing the image you have created / have been working on is transparent in the first place, using the "Resize" or "Resample" tools in any major image editing package (e.g. PhotoShop, PaintShop Pro and so on) should not affect (or lose) the transparency at all.
I use PaintShop Pro (X6, 64 Bit) myself and typically find that the "PNG Optimizer" option offers more options along these lines (than the default "Save As > .png" route).
Hope that this helps (specific to PaintShop Pro Users) in relation to the source question.
While I was waiting for the downloads of other image editing softwares, I tried Microsoft Power Point and succeeded in preserving the transparency.
Drag the image inside any slide, crop or resize, then save as a new picture as .png.
You can drag the image back in ppt to confirm the transparency is maintained
The complete Autodesk Sketchbook is now out for free including all the previous premium features such as resizing an image.
You do it as you would in paint by clicking on Image > Image Size... and then you can save as a .png without losing transparency.
Image size can be reduced by reducing number of colors and there are online tools to do this .
Try these..Hope they solve your problem
https://tinypng.com/‎
http://pngcrush.com/ and
http://tools.dynamicdrive.com/imageoptimizer/ --It provides more output images with different number of colors. However, smoothness will be effected, take care.

wix override ui banner causing artifacts

I am trying to overrride the banner in my custom wix ui.
I have successfully done this using
The banner normally looks like this:
When I build the MSI and run it the banner is replaced but there are weird artifacts in it like this:
The edges seem to have gone all jagged (note the white up the top was me blanking out product name)
Is there a reason why the image goes like this and possible a way to avoid it?
Irfanview shows the following for the image properties:
This is because the banner size in the MSI Wizard is different from the described default size of 500 × 63. You can use Paint to measure the banner. I've got 494 × 58 px on your screenshot. (I can't say the size of the banner bitmap we use at the moment, will add later.)
Note however: this size will work for default DPI setting of 96 dpi. If you choose 120 dpi or other settings, the size of the dialogs will grow, bitmap will be scaled and look jagged consequently. I do not know a workaround to this.
From what I could tell the original image was actually 500 x 63 (at least as reported by IrFanView and Paint)
I made a new image that was the size of 493 x 58 and DPI of 96 and this seems to have prevented the jaggies.
I looked at the Wix source and the UIExtension dialogs have the following line (or similar)
It looks like the image control is set to 370x44. I did try creating an image that size but still had problems.

Resources