How to get imagemagick to support .flif and .bpg formats? - imagemagick

For quite some time now there have been several image codecs which provide significant improvements over PNG and JPG, however the latter still remain dominant.
Two formats in particular that I'd really like to see getting more adoption are FLIF and BPG. They seem superior in every possible way to JPG and PNG (except for lacking market acceptance). Especially FLIF seems extremely promising.
TL;DR = Besides supporting them in my own software, is there a way to get FLIF and BPG support in imagemagick?

The ChangeLog for ImageMagick says
2015-06-25 6.9.1-7 ... * Support BPG image format
There's no direct BPG support in the ImageMagick source code, but config/delegates.xml lists delegates "bpgdec" and "bpgenc" which convert BPG files to and from PNG files which then get processed by ImageMagick. You would have to supply those delegates if they aren't already on your system. You can download the sources for bpgdec and bpgenc from
http://bellard.org/bpg/
There's nothing about FLIF in the ChangeLog, but a "pull request" for FLIF support was recently applied, and coders/flif.c exists in the ImageMagick sources (it requires a separate libflif to work). You can download the source code for libflif from https://github.com/FLIF-hub/FLIF
I haven't tested either feature.
bpgdec, bpgen, and libflif are all LGPL-licensed, and a reduced version of bpgdec is available under a BSD license.

To get imagicmagick to work with .bpg you have to compile it separate from what is already there. In other words, you have to add it in. So download the source code and it doesn't compile. Give up and use something else or try this because I got it to work
use apt-get and install
libpng*
libsdl1*
libsdl2*
libsdl-image*
cmake
libjpeg*
and maybe libjpg*
decompress the .bpg files you downloaded and just
use the command
make and sudo make install
AFTER that imagemagick will work with libpg and will not give an error of a missing delegate..

Related

Decompression of memorystreams using LZMA

I have a Remote Administration Tool and was necessary change for 64 bits plattform. I have used Zlib for compress and decompress memorystreams, but after do this change, Zlib classes showed several errors when I tried compile my project in 64 bits plattform, because Zlib only is avaiable for 32 bits plattform.
Then,I had that search on internet for some similar classes for make compress and decompress of memorystreams and I found this question where discussion is about LZMA class that also can make like I need, similar to Zlib class.
And I understood the advice:
The big issue that you will face is that the library you have chosen to use requires you to know how large the file is that you are decompressing.
So, I'm here exactly for know some suggestion for try solve this trouble.
In others words, I want know how decompress exactly the size of memorystream that is received by Server side of my project?
Any opinion or suggestion here is welcome.
OK, it looks like you're using ZLibEX, by Roberto Della Pasqua, Borland:
https://github.com/senjaxus/Delphi_Remote_Access_PC/blob/master/Fontes%20Access%20PC%20-%20Delphi%207/Cliente/ZLIBEX.pas
You're correct - the assembly portion MoveI32 is non-portable.
BUT ...
You should be able to use the same API in your current Delphi XE-5 from System.Zlib:
http://docwiki.embarcadero.com/Libraries/XE5/en/System.ZLib
http://delphiblog.twodesk.com/native-zip-file-support-in-delphi-xe2
http://docwiki.embarcadero.com/CodeExamples/Seattle/en/ZLibCompressDecompress_%28Delphi%29

Using LibTiff with Delphi

I'd like to use LibTiff with XE3 to access image meta data information from TIFF files.
I need to find the number of pages inside tiff and their sizes.
I suggested LibTiff because I need the fastest possible implementation of reading tiff image meta data.
The only link I have found is not working anymore:
http://www.awaresystems.be/imaging/tiff/delphi.html
OK, Internet Archive has returned back to operational state, and here is your download:
LibTiffDelphi, full version. Large download (approx 1.39 megabyte), includes Debug and Release versions
Well, the download links at that site do appear to be down. You could try downloading from here instead: http://www.vdebris.comli.com/wp-content/uploads/2009/09/libtiffdelphi_3_9_1.rar
I think you could use Mike Lischke's GraphicEx to solve your problem. The TImageProperties record that is made available by the TGraphicExGraphic class appears to have what you need.
found that code working with *.tif and used graphics + lib for solution building TIF SPLITTER
not sure if it helps to solve your problem

IplImage 'None' error on CaptureFromFile() - Python 2.7.1 and OpenCV 2.2 WinXP

I am running Python2.7.1 and OpenCV 2.2 without problems in my WinXP laptop and wrote a tracking program that is working without a glitch. But for some strange reason I cannot get the same program to run in any other computer where I tried to install OpenCV and Python (using the same binaries or appropriate 64 bit binaries). In those computers OpenCV seems to be correctly installed (although I have only tested and CaptureFromCamera() in the webcam of the laptop), but CaptureFromFile() return 'None' and give "error: Array should be CvMat or IplImage" after a QueryFrame, for example.
This simple code:
import cv /
videofile = cv.CaptureFromFile('a.avi') /
frame = cv.QueryFrame(videofile) /
print type(videofile) /
print type(frame)
returns:
type 'cv.Capture' /
type 'NoneType'
OpenCV and Python are in the windows PATH...
I have moved the OpenCV site-packages content back and forth to the Pyhton27 Lib\Site-packages folder.
I tried different avi files (just in case it was some CODEC problem). This AVI uses MJPEG encoding (and GSpot reports that ffdshow Video Decoder is used for reading).
Images work fine (I think): the simple convert code:
im = cv.LoadImageM("c:\tests\colormap3.tif")
cv.SaveImage("c:\tests\colormap3-out.png", im)
opens, converts and saves the new image...
I have tested with AVI files in different folders, using "c:\", "c:/", "c:\" and "c://".
I am lost here... Anyone has any idea of what stupid and noob mistake may be the cause of this? Thanks
It may sound stupid, but I just had the same issue with the same symptoms for the same code snippet (Python 2.7.1, Win 7, OpenCV 2.2.0). I changed file path from
capture = cv.CaptureFromFile('C:\Misc\tree.avi')
to
capture = cv.CaptureFromFile('C:/Misc/tree.avi')
and voila
<type 'cv.Capture'>
<type 'cv.iplimage'>
I was having this problem, and here is how I fixed it. I took a look at the output of OpenCV's cmake command, and it had the following line:
...
-- FFMPEG: NO
...
In order to fix this, you might be able to get away with simply installing the following libraries:
sudo apt-get install libavformat-dev libavcodec-dev libavfilter-dev libswscale-dev
Re-running cmake will hopefully now say:
...
-- FFMPEG: YES
...
Re-compile OpenCV, re-install it, and hopefully you can now read videos. If you still have problems, you can try to compile ffmpeg using the --enable-shared option, using these as guides:
http://opencv.willowgarage.com/wiki/FFMPEG
http://ubuntuforums.org/showthread.php?t=786095
Hope that helps.
This must be an issue with the default codecs. OpenCV uses brute force methods to open video files or capture from camera. It goes by trial and error through all sources/codecs/apis it can find in some reasonable order. (at least 1.1 did so).
That means that on n different systems (or days) you may get n different ways of accessing the same video. The order of multiple webcams for instance, is also non-deterministic and may depend on plugging order or butterflies.
Find out what your laptop uses, (re)install that on all the systems and retry.
Also, in the c version, you can look at the capture's properties
look for cvGetCaptureProperty and cvSetCaptureProperty where you might be able to hint to the format.
[EDIT]
Just looked i tup in the docs, these functions are also available in Python. Take a look, it should help.

Using EXR images in OpenCV

I'm currently working on a project with OpenEXR and I would like to implement some Blob detection algorithms. To do this I figured that I could use OpenCV as it says in the documentation that it can open OpenEXR format files.
I have all the libraries installed and working as I've been doing other things. I open a simple jpg file with openCV cvLoadImage. It works fine. But when i try to open any .exr file it doesn't seam to like it. I get a gray window where there should be the image display.
Has anyone done any tests with OpenCV and OpenEXR libraries working together? Have they worked for you? What do you think?
Thanks.
Yes, that's done, I posted a Ticket in the OpenCV project at willowGarage and they made all needed changes, you now can use OpenEXR with OpenCV as before!
Great
My HDR tone mapping algorithm will work again, cool
Have a nice programming now ;o)
Alex
Well Alex!
My news aren't really encouraging... I tried to use OpenEXR with OpenCV but it's not doing it's work. It says in the documentation that OpenCV 2.0 has OpenEXR support but...
I've searched the web to find some example of working EXR images in OpenCV but had no luck.
At this time I've developed myself a function to convert an image read with the OpenEXR libraries that uses Ilm::Rgba* structure to save the pixels of the image and convert it to char* that OpenCV uses with images. The IlpImage structure is the one I use. Actually I'm working with an example from OpenFrameworks and using they're Image structure...
It's a really early stage in my development because I had to start over...
I hope this can help you... but if you enter the world of OpenEXR it's a pretty dark world in terms of documentation, so all I can say is good luck!
Feel free to contact me and I'll see if I can help you!
This question is rather old now, but I noticed whilst reading the OpenEXR manual today that it says (whilst talking about reading named channels)
If one of those channels is not present in the image file, the corresponding memory buffer for the pixels will be filled with an appropriate default value.
I'd speculate here that the grey image you are seeing is an "appropriate default value".

Problem with showing some JPG files in Delphi

i have tried to open some JPEG files in Delphi with TImage component. i also added the Jpeg unit. i can open most of jpg files and there is no problem.
but when i try to open some JPGs, the program just throw an exception.
i also tried to load that images in design mode, but there is some problem. in design mode the exception is:
Access violation at address 402672A1 in module 'vcljpeg70.bpl'. Write of address 08E84000
Why i cannot open that JPGs? they are not corrupted. i checked them in some tools like savantools EXIF viewer.
here is the URL of one of that images:
http://xs842.xs.to/xs842/09340/backpic435.jpg
Thanks so much
PS:
My Delphi version is 7. Borland Delphi 7
The reason you may be encountering this problem is due to the file type. Delphi has issues displaying JPEG images that have been encoded using CMYK, rather than the default RGB encoding. CMYK is a format that is generally used for Print design, try and always encode your images to RGB format to avoid this issue with Delphi.
Patch for Delphi jpeg.dcu
Bye.
Interesting. Neither Internet Explorer nor Google Chrome will display that JPEG image you linked to. I do not get 404 Not Found errors, I simply get an image placeholder, indicating that the image could not be opened/displayed correctly.
FireFox does display the image.
Are you certain that there is not something fishy, or at least slightly unusual, about the JPG files involved?
UPDATE: The file linked to in the question opens in PaintShop Pro (an old version 6.0 installation) - if I then simply re-save as a Standard Encoding JPEG, IE and Chrome both display the newly saved image as I'd expect. There would definitely appear to be something a bit "odd-ball" about the encoding of the original JPEG that some JPEG apps can handle but not all, including some "major players", not just Delphi. :)
Check out the Free Image library for alternative JPEG support in Delphi if the native one has problems. Free Image is an open source lib that lets you work with JPEG/PNG/... from Delphi/BCB/and others. Very nice library IMHO.
http://freeimage.sourceforge.net/
I've looked at the file with a hex editor, and found 3 JFIF headers. After extracting each part, I found 2 thumbnails and an image. Nothing special, because embedded thumbnails seem to be part of the EXIF2 standard.
The thumbnails themselves load fine in Delphi, and converting the file to something readable can be done with almost every piece of software that I've tried.
Anyway, this page will give you very detailed information about the picture, and what headers are inside (just paste the url of your image in the textbox):
http://www.monster-submit.com/resources/jpeganalyzer/
I get the same error. This appears to be a bug in Delphi's JPEG lib. You should report it to QC.
SimDesign's NativeJpg can open that file. It's a JPEG library written entirely in Delphi, and the author has been good about adding support for new extensions and color spaces when we've run into them. In addition to a TGraphic descendant for TImage support it exposes lots of lower-level interfaces for manipulating JPEGs, though I haven't used them.

Resources