ImageMagick and RMagick both have a setting/attribute for "density", which is what they call resolution. I can pass it a value of 200 and it should set the resolution to 200x200 when the image is written to either a file or to_blob.
In the Rails console I can load the image, then set the density, and if I check it, it will tell me the density (originally 300x300) is now 200x200, but when I write it out to a file, the resolution is 300x300.
The only way I've successfully been able to change the resolution is by creating a new image of the same width and height, then overlay the original image. This, however, distorts the output, no matter what settings I use (I tried setting the original to fully opaque, the "new" to fully transparent, and even used the CopyCompositeOperation, which should fully replace the "new" image).
I have tried setting density like this:
image.density = "200"
And like this
image.write("test.jpg") {self.density="200"}
And both.
Nothing works... any ideas?
To be clear... I don't want to resize the image, I want to change the print resolution. I want the dimensions to remain the same (i.e. width/height should NOT change).
This was an issue with the version of ImageMagick that AWS has in its repositories. Removing that version and installing from source made the density setting work. Also, if you want the resolution change to be reflected in Windows applications, you need to strip the "8bim" profile from the image:
image.profile!("8bim",nil)
Related
I am running the apple sample project of ARKit 1.5 Image detection
but when I place my reference image inside AR Resource folder and run the app I get following error:
Make sure all reference images are greater than 100 pixels and have a positive physical size in meters.
I don't find any predefined requirements of how should the image be, can anyone explain the required attributes of the image?
As in Apple's documentation
For each image, use the inspector to describe the physical size of the
image as you’d expect to find it in the user’s real-world environment,
and optionally include a descriptive name for your own use.
Click on your image and chose size inspector to provide size. :)
In my particular case, the dimensions were set and the image was named. But the name itself was invalid because I had another file (of a different type) named the same.
If the accepted solution cannot solve your issue, try changing the AR Resource's name.
I had same problem. Solved by using JPEG format instead of PNG
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.
Icons Are Pretty Right?
I'm working on an UI update in an iOS app, and trying to make things look a bit better with some new icons- but I seem to be incapable of determining how to save an image correctly so that it looks good in the interface!
As you can see from this image, if I include a white background with the image it looks great. If I take those same images and use an alpha background they look terrible! It appears that either the images aren't using the #2x correctly, or something else is going horribly wrong.
These images are either saved with GIMP as a png with alpha, or exported from inkscape, the originals are vector graphics. We get the same results from both avenues. I am using both a base imageName.png and imageName#2x.png for scaling.
Somehow, magically, I changed the a single image to greyscale in gimp, and changed the base size to 25px and it showed up with alpha correctly blended. Stock images from apple are also functioning correctly, so it absolutely seems to be something that I'm doing incorrectly when I'm saving the images.
The Setup in XCode
Basic Questions
Is there a certain bit depth, argb vs rgba format, or some other quirk that I need to know to get these images to show up correctly? Is there any way to verify that the program is loading the correct imageName#2x vs imageName? Is there some document that talks about integrated graphics (the iconography documentation isn't very helpful on technical details)
Actual Images
With Background:
Without Background:
I think you will find success if you just save the image at 4x the size you actually want and specify the size manually.
Is there a way to get the image dimension of an image that was just resized? What I'm foing is taking a file and fitting it to a 48x48 area (note, I said FIT, not scale.) Once that's done, I need to get the new image's dimension but I don't want to have to write it out to disk, then reading it back in to use. Is there a way to do it without that step?
$img = new Imagick('file.jpg');
$img->resizeImage(48,48,Imagick::FILTER_LANCZOS,1,TRUE);
// this is where I need to get the dimensions of the new image created above, unless it's a perfect square, only one side will be 48 pixels, the other could be less.
Thanks.
I have read the recent posts on the Highcharts.com website regarding their updated PhantomJS based exporting-server. I have also cloned their github repository and successfully compiled their web-service. However, all files produced by this server are marked as 96dpi, which is inadequate for my purposes. According to somewhat contradictory information on the Highcharts.com website (Here and Here), they are using Batik to rasterize PNG and JPG output, which should make it possible to adjust the DPI settings of the exported raster images. However, the pom.xml doesn't include any batik references and I can't find anything in the source code which indicates that anything other than PhantomJS is being used to produce the raster renditions. The PhantomJS export might be able to adjust the DPI, but I can only find the scale and width options which don't directly adjust the DPI, thus requiring a tedious post-processing rescale (or metadata edit) to adjust the DPI accordingly.
So, the meat of my question: how to adjust the exported DPI of a highcharts chart in PNG and JPG format when using the highcharts java exporting-server?
The release before the last one used both Batik and PhantomJS. The last release uses only PhantomJS. This is why you do not find any Batik references in the pom.xml anymore.
For controlling the dpi of the exported image. You should use the scale parameter. For completeness sake, here is how Highcharts determines the dpi of the exported image.
Controling the size of the exported image
Since Highcharts 3.0 and Highstock 1.3, the size of the exported image is computed based on a few rules:
If the exporting.sourceWidth and exporting.sourceHeight options are set, they take predence. This provides a convenient way of having separate sizes of the on-screen chart and the exported one.
If not, and the chart.width and chart.height options are set, those are used for the exported chart.
If a size hasn't been found yet, and the containing div has an explicit pixel width or height, that width or height is used. Percentage and other non-pixel widths will not take effect. This prevents a common pitfall in Highcharts 2, where charts with the typical 100% width would look out of proportion in export.
If a size still hasn't been found, it defaults to 600 by 400 pixels.
After rendering the chart width the above size, and all text sizes in relation to that, the actual image resolution is determined by exporting.scale which defaults to 2. In practice this means that a 600x400 chart will return an image of 1200x800 pixels by default. The rationale behind this is quite simple - if we used a scale of 1 and just set the sourceWidth to 1200 and sourceHeight to 800, all the text would become too small. And if we didn't scale it up, the resolution would be too small for print.
Read also here for more on the export server