iOS 11 heic format adds artifacts to masked image - ios

I'm using the new HEIC format to save a masked image to documents directory.
When comparing to the PNG version of the same masked image I see that some new articafts have been added.
Here is a screenshot of the effected image:
Here's a link to working repository showcasing this issue (please view the generated image through the new ios 11 Files app).
https://github.com/vondiplo/heic_wrong_encode

The mask provided in the git is an 100x98 px, try to use a bigger resolution image as mask that's the reason why there are artifacts, also keep in mind that PNG is uncompressed while hevc/heif is compressed so you can't really compare them.
Edit
Since a better mask won't resolve your problem you'll have to stick with png, artefacts are an known block compression problem as this article describes
http://blog.biamp.com/understanding-video-compression-artifacts/
There is a posible solution to that, but i didn't see documentation from apple how it could be implemented, more details in this link http://www.uta.edu/faculty/krrao/dip/Courses/EE5359/Proposal%20HarshalShah-Interim-deblockingfilter.pdf

Related

what is the best to way to get the vector image for asset catalog

I am aware xcode has introduced an option to provide a vector image(.pdf) so that we don't have to give a image for each dimension such as 1x,2x,3x
This saves lots of time and its really a good feature
But how to go about making an vector image in .pdf format.
As far as I know any png image can be saved as .pdf image does it mean it has been vectorized ?
or else we have to do it in the harder way .. by installing adobe illustrator and making an vector image through that
or else it there any web app that does it for us
basically I want to do the right way so the when image is displayed in 3x devices also there is no image distortion
This is a supplement to the excellent answer by #Senseful.
How to make vector images in .pdf format
I will tell how to do this in Inkscape since it is free and open source but other programs should be similar.
In Inkscape:
Create a new project.
Go to File > Document Properties and set the custom page size to whatever your #1x size is (44x44, 100x100, etc) with the units in px.
Make your artwork.
Go to File > Save As... > Printable Document Format (*.pdf) > Save > OK. (Alternatively, you could go to Print > Print to File > Output format: PDF > Print but there are not as many options.)
Notes:
As is mentioned in the accepted answer, you cannot resize your image because Xcode still produces the rasterized images at build time. If you need to resize your image you should make a new .pdf file with a different size.
If you already have an .svg image that is the wrong page size, do the following:
Change the page size (Inkscape > File > Document Properties)
Select all objects (Ctrl+A) on the work space and resize them to fit in the new page size. (Hold down Ctrl to keep aspect size.)
To convert an .svg file into a .pdf you can also find online utilities to do the job for you. Here is one example from this answer. This has the benefit of allowing you to set the .pdf size easily.
Further reading
Using Vector Images in Xcode 6
Original answer

Deepzoom images: starting image quality

I am working on implementing a zoomable image viewer using OpenSeadragon and deep zoom images. I used the VIPS command line tool to create DZI files. My question is, does the original image used to create DZI files need to meet specific requirements to make it zoomable? (like format, size, etc.) If a normal .jpg image is converted to DZI, it seems like the image will not be zoomable. Is this correct?
My question is, does the original image used to create DZI files need to meet specific requirements to make it zoomable?
No, except to have a resolution higher than the screen resolution (in that case, the original image can be displayed directly).

iOS image quality improvement

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.

vector images in xassets have different colors

I'm pulling pdf files into Xcode via images.xassets -> image set -> type: vectors. The PDF looks great, but when I look at the images on the device, the colors are changing slightly. Exporting the PDF as individual PNG files and doing it the old way is working fine.
Has anyone else run into this? The color change is bad enough to revert back to the old way for any non monochromatic image. When exporting to PDF with Illustrator, verified that we're using RGB mode and not anything else
check out the deployment target, it should be 7.0 or above. Because of Vector pdf only supports 7.0 and above.
Check Alpha value. I had this issue in the past and the alpha value caused this problem. If i had saved my images with this colours would have been changed a little.
There is a setting on illustrator when exporting to PDF that was causing my problem. Follow: Xcode generates png form pdf with different colors

How can I get ColdFusion to scale images of any type?

Server Config:
Windows Server 2003
IIS 6
ColdFusion 8 Standard Edition
Java Version 6 Update 18
I have a ColdFusion application that allows users to upload images that will be added to an existing PDF. When the images are added to the PDF, they have to fit within a minimum/maximum height and width, so the uploaded image needs to be scaled to fit.
For instance, let's say the minimum height and width for a given image is 100x100, and the maximum height and width is 200x200, and the user uploads an image that is 500x1000. I use the logic below to scale that image down without skewing the image (it keeps its original shape) to 100x200. For an image smaller than the minimum, it is scaled up (in the example above, a 50x50 image would be scaled up to 100x100).
Unfortunately, I'm running into a lot of problems with users uploading "invalid images". I know that ColdFusion has problems working with Progressive JPEGs and CMYK JPEGs, but even some TIFFs are throwing errors. Also, a 3MB TIFF image takes over a minute to scale (not to mention the loss of resolution that occurs, which I have submitted as a separate question here.)
I've added logic to prevent ColdFusion from trying to process an "invalid image" by using the IsImageFile() function, but the users are very frustrated when they have an image that they can open and view on their PC, but we can't accept it. Do online print companies (i.e. Shutterfly, Kodak, etc.) have these issues? I can't remember ever having an issue on these websites (though I know they may not necessarily use ColdFusion).
Any thoughts on what I can do to allow more types of images to be used (Progressive, CMYK, etc.) and improve performance?
You will likely have to use a non-CF solution like we had to do before CF8. Some libraries mentioned here: https://stackoverflow.com/questions/158756/what-is-the-best-image-manipulation-library
Scaling time is heavily dependent on the algorithm you chose to use. Adding images to PDFs in ColdFusion is unpredictable at best. I found them to be often inflated, dramatically increasing the PDF file size.
Here is some information from the docs:
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=functions_in-k_16.html
Supported image file formats
The cfimage tag operates on a number of different file formats. To list the formats that are supported on the server where the ColdFusion application is deployed, use the GetReadableImageFormats function and the GetWriteableImageFormats function.
ColdFusion supports the following default image formats on Macintosh, Windows, and Unix operating systems:
JPEG
GIF
TIFF
PNG
BMP
ColdFusion does not support the following image formats:
Animated GIF
Multipage TIFF
PSD
AI
CMYK support
The cfimage tag supports reading and writing CMYK images, but does not support actions that require converting the images. For example, you can use CMYK images with the read, write, writeToBrowser, resize, rotate, and info actions. You cannot use CMYK images with the convert, captcha, and border actions. The same rule applies to image functions. For example, the ImageNew, ImageRead, and ImageWrite functions support CMYK images, but the ImageAddBorder function does not.

Resources