UIImageJPEGRepresentation generates JPEG without SOI Marker - swift

I'm generating JPEG image data using UIImageJPEGRepresentation(UIImage, 1.0) in Swift version 4(?).
I'm using a 3rd party JPEG decoder but it throws an error that no SOI (start of image) marker was found.
How do I generate a correctly formatted JPEG with SOI markers in Swift (preferably) or Objective-C?
Is this a known issue in standard Swift and should I start looking at 3rd party JPEG encoders?

Resolving under the assumption that the fault lies in the decoder and not UIImageJPEGRepresentation.

Related

ItextPdf throws IllegalArgumentException while converting tiled tiff into pdf

I am trying to convert a tiled multipage tiff into pdf using #itextpdf version 5.4.1. But itextPdf throws IllegalArgumentException while processing such tiffs. Do ItextPdf support conversion of tiled tiff? If not, what alternative way can be used for such conversion?
If you look at the details of that IllegalArgumentException you'll see that it's message is Tiles are not supported. Thus,
Do ItextPdf support conversion of tiled tiff?
No, iText does not support conversion of tiled tiff images to PDF images.
what alternative way can be used for such conversion?
Preprocess the image and transform it, either into a non-tiled tiff or into a different bitmap format altogether, before using it in iText.

Image Depth Error in NIST FpMV- Beta V3.0 application?

I tried viewing fingerprint minutiae points using Fingerprint Minutiae viewer. When I do it with a grayscale image from database, it works fine. But after performing image processing functions to enhance the image, when I save the output image using "saveas()" command in Matlab and use this image as input to the FpMV application it gives following error:
Error: Image is not 8-bit grey scale
I tried converting image to grayscale using "im2unit8" but it gave the same error.
Can someone help me in resolving the error?
Here, I'm attaching snapshot of error along with the GUI interface of FpMV:
GUI interface of FpMV along with the error

Artifacts appear using imread function from opencv

I use imread function to read one jpeg file and save the rgb image in bmp format. Comparing the two files, I found artifacts appear and use green circle to denote artifacts. The version of OpenCV is 3.0. I compile the libraries by myself with SSE, SSE2 and SSE3 switchd on (default setting). My OS is windows 7 professional. You can use the following image to check.
original jpeg image
saved bmp file
If I read the jpeg file in Matlab, the rgb image is correct. I save rgb image in png format in Matlab, read the png file using opencv and save the loaded image in bmp file. Everything is OK. It seems that there is a problem with jpeg decoder. The jpeg library used is libjpeg.lib.
Due to the size limit, I cut the patch from the second image.
You're always going to get some artifacts in JPEG. You can reduce the appearance of such artifacts by changing the quantization tables used (usually with loss of compression).
JPEG encoders often use a "quality" setting to change the quantization tables.

PIL: converting an image with mode "I" to "RGB" results in a fully white image

The image at the end of this question is a PNG with mode I, which stands for Indexed, as far as I can tell.
I'm trying to create a thumbnail out of it, and save it as JPG with PIL.
However, is I leave the mode alone, PIL won't let me resize it with error unable to generate thumbnail: cannot write mode I as JPEG.
If I convert it to RGB, the result will be a fully white image.
Is there a way to fix this?
https://www.dropbox.com/s/2d1edk2iu4ixk25/NGC281.png
The input image is a 16-bit grayscale PNG, and it appears PIL has a problem with this. Manually converting it to an 8-bit image before further processing makes it work again.
The problem may originate inside PIL itself. The PyPNG homepage asserts
..PIL only has internal representations (PIL mode) for 1-bit and 8-bit channel values. This makes me wonder if PIL can read PNG files with bit depth 2 or 4 (greyscale or palette), and also bit depth 16 (which PNG supports for greyscale and RGB images).
Then again, that page is from 2009. It could be worth tracking down where PIL is maintained from, and report this as a bug (? Or possibly a feature request?).

Image Sequences to video conversion in matlab

I have to convert image sequences to a video using 'matlab R2010a' version. What function should I use to load images to a video? In 'Matlab R2013a' version, 'writeVideo' is used. What is the related function of 'writeVideo' in 'R2010a' version?
If your images are created by some Matlab code, then you can always save them as image files (check out the print function), and use some utility (like VirtualDub) to convert the image files to video.
If it is enough to play the image sequence without saving it, then use the movie function.