Gimp exports: Why is the image size increased? - image-processing

I'm trying to use a two step process of employing Gimp to delete sections of images and then using Inkscape for the remainder of the image work.
Unfortunately, I'm seeing a resolution change when doing the export to PNG from Gimp.
The exported image is around 50% larger than the original, which impacts the quality.
Is there a way to keep the resolution constant when exporting the file?
Hopefully I'm just forgetting something, since I've spent some time away from image work.
Please let me know if any additional info is required.
In the interim, I'll try another tool to do the Gimp step.
THANKS!
Edit: Updated size to resolution.

For a bitmap/raster image, resolution (for Gimp: "Image print resolution", see Image>Print size) is indicative. The only thing that counts is the size in pixels.
If you have image window set to "Dot for Dot" (Edit>Preferences>Image Windows->General>"Use dot for dot" or View>Dot for dot) the image is displayed with the definition of your screen (around 100PPI fore regular screens, 20OPPI for high def ones (Retina, etc...).
When you create the image (File>New...), you can specify a print definition and a print size, and Gimp will compute the required size in pixels.

Related

ImageJ TIFF import image dimensions?

I have a bunch of auto-scanned slides using a slide scanner (Hamamatsu), which I can export from the NDPview software at different magnifications. So far, I have been zooming in to where I get the best resolution of my region on interest and add a scale bar for 1mm (as 1000 um) using the native scale bar option in the NDP view software. I then export the "view" from NDPview to TIFF. This TIFF is then imported into ImageJ (Fiji) where I set the scale using the scale bar I drew. This has been working well, but with over 500 images to do it's a bit of a pain.
Since the TIFF imports to ImageJ with inchxinch dimensions, I figured I can go to Image -> Properties and just change the unit of length to um. To test this, I selected an area to measure. I then compared this to my old method... and the values are completely different. Any idea why? 1 is the old method, 2 is the new method.
I made certain to "remove scale" in the scale bar window between each test. The whole image dimensions are different too:
If the images are all the same magnification and resolution, then as long as you know a measured distance (in pixels) and the physical distance (in microns or mm), you can set it using Analyze > Set Scale...
To do this in a macro you can use
run("Set Scale...", "distance=255 known=1 pixel=1 unit=micron");
where 255 is the distance in pixels for your known unit (1 micron). This can be applied to all TIFFs in a folder if you wrap that line in a loop operating on all TIFFs and save each resulting image.

button image gets pixelated

I have designed a lock icon in Sketch to add to a button in my application:
I exported it both in pdf and png (2x, 3x) to add to Xcode assets. Problem is when I run the app on iPhone (SE), heavy pixelation can be seen around the edges of the icon:
I've tried both pdf and png formats, but result stays the same. Am I missing any settings that need to be applied for image to look sharp on screen?
Bigger is not necessarily better for a UIButton's image. Try to export your icon in more or less the same size with which it will be used. (Note that this also frees up memory in comparison to a way bigger image).
To adapt to different screens' resolutions, you should provide up to three images (#1x, #2x, #3x). You should read this excellent Apple's documentation on Image Size and Resolution. It explains perfectly how big should the images you provide in Xcode be.
They also have a good explanation on which format you should use according to the purpose of the image.
EDIT:
You can also use vector ressources (.pdf files for instance) that will render perfectly for any resolution. You can read this article about how to implement it in your Xcode project (If you do so, please be careful in the attributes of the asset to check Preserve Vector Data and the Scales to Single Scale, otherwise it may not render well).
It will happen if image sizes are not correct
check the size of images. 1x,2x and 3x sizes are should be as followed
1x = 24x24 px
2x = 48x48 px
3x = 72x72 px
If images size are too big than ImageView then pixelate will happen
Hope this will help you

supplying the right image size when not knowing what the size will be at runtime

I am displaying a grid of images (3rows x 3 columns) in collection view. Each image is a square and its width is determined to be 1/3 of collectionView's width. Collection view is pinned to left and right margin of the mainView.
I do not know what the image height and width will be at runtime, because of different screen sizes of various iPhones. For example each image will be 100x100 display pixels on 5S, but 130x130 on 6+. I was advised to supply images that exactly matches the size on screen. Bigger images often tend to become pixelate and too sharp when downsized. How does one tackle such problem?
The usual solution is to supply three versions, for single-, double-, and triple-resolution screens, and downsize in real time by redrawing with drawInRect into a graphics context when the image is first needed.
I do not know what the image height and width will be at runtime, because of different screen sizes of various iPhones. For example each image will be 100x100 display pixels on 5S, but 130x130 on 6+
Okay, so your first sentence is a lie. The second sentence proves that you do know what the size is to be on the different screen sizes. Clearly, if I tell you the name of a device, you can tell me what you think the image size should be. So, if you don't want to downscale a larger image at runtime because you don't like the resulting quality, simply supply actual images at the correct size and resolution for every device, and use the correct image on the actual device type you find yourself running on.
If your images are photos or raster type images created using a raster drawing tool, then somewhere you will have to scale the original to the sizes you want. You can either do this while running in iOS, or create sets up front using a tool which can give you better scaling results. Unfortunately, the only perfect image will be the original with everything else being a distortion of the truth.
For icons, the only accurate rendering solution is to use vector graphics. Tools like Adobe Illustrator will let you create images which you can scale to different sizes without losing clarity. Unfortunately this still leaves you generating images up front. You can script this generation using most tools and given you said your images were all square, then the total number needed is not huge. At most you need 3 for iPhone (4/5 are same width, 6 and 6+) and 2 for iPad (#1 for mini/ipad1 and #2 for retina).
Although iOS has no direct support I know of for vector image rendering, there are some 3rd party tools. http://www.paintcodeapp.com/ is an example which seems to let you import vector images or draw vector images and then generate image code to run in your app. This kind of tool would give you what you want as the images are now vector drawings drawn at the scale you choose at run time. $99 though.
There is also the SVGKit (https://github.com/SVGKit/SVGKit), but not sure how good/bad this is. It seems to let you simply load and render direct from SVG files. Might be worth trying.
So in summary, I think you either generate the relatively small subset up front using a tool you can control the output from, take the hit in iOS and let it scale the images or use a 3rd party vector to image rendering kit which would give you what you want.

Tilemap gets messed up when converted to hd

I have a floorplan that I need to turn into a tilemap. I'm using the program HD2x to convert my tilemap into an -hd tilemap. I tried it in different ways:
1)I converted the floorplan into a -hd .png with HD2x, and then put this into Tiled, and the saved it and converted the final .tmx file into -hd. I then put the -hd tmx and -hd png file into x-code.
2)I put the regular floorplan into tmx, and then converted this into -hd and converted the floorplan.png into -hd, then put these into x-code.
These aren't working.. either the tilemap is half the size it should be, or it's a QUARTER of the size it should be and the floorplan looks messed up.
Please help.
Original Comment
You might be using the program wrong. It doesn't make sense that a tool would take an SD image and make it HD. Most likely it is meant to take an HD image and cut its resolution in half for the SD version.
Answer
It seems like you are creating images that are half the size of the original, but you are expecting it to do the opposite. In general you wouldn't want to go from SD to HD by simply increasing the image's resolution because the quality would drop. Taking an image and simply doubling its size will not look good.
But quality aside it wouldn't make sense for someone to create an application that increases your resolution for you by simply doubling its size. If that specific application you are using has that as an option, you are likely not setting the right option. From the sounds of it the application is creating images half the size of the images you are feeding it. That is likely the reason why you are getting half or a quarter of the expected size.

How to get rid of empty transparent areas in a PNG image so that it conforms to actual image size?

I have a series of images that I would look to loop through using iOS's [UIView startAnimating]. My trouble is that, when I exported the images, they all came standard in a 240x160 size, although only 50x50 contains the actual image, the rest being transparent parts that are just taking up space.
When I set the frame of the image automatically using image.size.width and image.size.height, iOS takes into images' original size of 240x160, so I am unable to get a frame that conforms to the actual parts of the image. I was wondering if there is a way using Illustrator or Photoshop, or any other graphics editing software for me to export the images based on their natural dimensions, and not a fixed dimension. Thanks!
I am a fan of vector graphics and thinks everything in the world should be vector ;-) so here is what you do in illustrator: file - document setup - edit artboards. Then click on the image, and the artboard should adjust to the exact size. You can of course have multiple artboards, or simply operate with one artboard and however-many images.

Resources