I'm writing a Carbon application and we are creating JPEG files. I'm currently doing this by using Quartz CGImageDestinations and kCGImagePropertyJFIFDictionary. However, JFIF doesn't seem to have any entry for compression quality. Does anyone know how to set this?
thanks
This is separate from the JFIF options, since some other formats (including TIFF) support lossy compression. The key you use is kCGImageDestinationLossyCompressionQuality, and you put this option and the JFIF-options dictionary into the same dictionary; you don't put it into the JFIF-options dictionary.
Related
According to PDF format spec, it has various image compression filters including CCITTFaxDecode.
I'm using libharu and need to explicitly set compression filter to CCITTFaxDecode for all images in the generated PDF.
How can I tell libHaru to use CCITT compression for images in PDF?
Below is the where I am currently.
From the libHaru documentation, it has HPDF_SetCompressionMode() function which has the argument named mode. The argument has the HPDF_COMP_IMAGE option enabling images compression. But it's not clear how to choose which compressor to use.
Another thing, among libHaru source files there is CCITT compressor (hpdf_image_ccitt.c), but I can't figure out how to explicitly set it as the compressor for images.
Any help is greatly appreciated.
My read of the source in hpdf_image_ccitt.c is that the CCITT G4 encoder is selected automatically for eligible instances if HPDF_COMP_IMAGE is enabled. See https://github.com/libharu/libharu/blob/d84867ebf9f3de6afd661d2cdaff102457fbc371/src/hpdf_image_ccitt.c#L779 for where this looks to be the case.
Note that only black & white (1 bit per pixel) images can be CCITT encoded.
I am wondering if anyone has tried using compression techniques for their LMDB files? Typically, lmdb files typically do not use any compression. I am wondering if anyone has successfully stored data in an lmdb using jpeg compression on lmdb and then used it for caffe. I need this because I am working on a developer board with very limited storage space. If so, can you please provide steps/code to do this?
thanks
Caffe also supports HDF5 which supports compression. If your dataset is smth like mnist - it may be a good choice.
I'm looking for an effective method for automating the conversion of a number of images to the WebP image format. I'm particularly interested in a method that will keep the metadata or allow me to add or edit the metadata.
The easiest way would be <cfexecute> with cwebp https://developers.google.com/speed/webp/docs/precompiled
As for metadata...
WebP format do support EXIF/XMP metadata. The next version of WebP library (libwebp) will have appropriate APIs supporting handling of
EXIF/XMP metadata, along with supporting utility binaries to convert
JPEG/PNG to WebP format retaining the metadata from original files.
Quoted from WebP Google Group. Meanwhile, follow issue 52 for latest updates? https://code.google.com/p/webp/issues/detail?id=52
I know that JPG, BMP, GIF and others formats compress image. But can I get snapshot of display and save it without compressing(in binary file) in programming way (using c/c++ for example or other stuff)?
BMP files aren't compressed by default. See here: https://en.wikipedia.org/wiki/BMP_file_format
http://www.zlib.net is your best solution for loss-less compression in C. It's well-maintained, used in a host of different software and compatible with external archivers such as winzip.
C++ offers wrappers around it such as boost::iostreams::zlib and boost::iostreams::gzip.
Zlib uses the deflate algorithm (RFC1951); here a very good explanation of the algorithm: http://www.zlib.net/feldspar.html
The PAM format is uncompressed and really simple to understand.
I want to decode JPEG files and obtain uncompressed decoded output in BMP/RGB format.I am using GNU/Linux, and C/C++.
I had a look at libjpeg, but there seemed not to be any good documentation available.
So my questions are:
Where is documentation on libjpeg?
Can you suggest other C-based jpeg-decompression libraries?
The documentation for libjpeg comes with the source-code. Since you haven't found it yet:
Download the source-code archive and open the file libjpeg.doc. It's a plain ASCII file, not a word document, so better open it in notepad or another ASCII editor.
There are some other .doc files as well. Most of them aren't that interesting though.
Unfortunately I cannot recommend any other library besides libjpeg. I tried a couple of alternatives, but Libjpeg always won. Is pretty easy to work with once you have the basics done. Also it's the most complete and most stable jpeg library out there.
MagickWand is the C API for ImageMagick:
http://imagemagick.org/script/magick-wand.php
I have not used it, but the documentation looks quite extensive.
You should check out Qt's QImage. It has a pretty easy interface that makes this task really easy. Setup is pretty simple for every platform.
If Qt is overkill, you can try Magick++ http://www.imagemagick.org/Magick++/. It supports similar operations and is also well suited for that sort of task. The last time I used it, I struggled a bit with dependencies for it on Windows, but don't recall much trouble on Linux.
For Magick++'s Image class, the function you probably want is getConstPixels.
I have code that you can copy ( or just use as a reference ) for loading a jpeg image using the libjpeg library.
You can browse the code here: http://code.google.com/p/kgui/source/browse/trunk/kguiimage.cpp
Just look for the function LoadJPGImage.
The code is setup to handle c++ binding of my DataHandle class to it for loading the image, that way the image can be a file or data already in memory or whatever.
A slightly out of the box solution is to acquire a copy of the netpbm tools, which transform images from pretty much any format to any other format via one of several very simple intermediate formats. They work well from the shell, and are most often used in pipes to read some arbitrary image, perform an operation on it, and write it out to some other format.
The pbm formats can be as simple as a plain ASCII header followed by the RGB data in ASCII or binary. They are intended to be simple enough to use without required a library to implement.
JPEG is supported in netpbm by read and write filters that are implemented on top of libjpeg.