I have been searching for hours how to convert XImage (From XLib) to a PNG format. There were some sources, but none of them did work. I want to restrain to libpng or OpenCV if that is possible.
How can I achieve this?
Sources:
http://www.codemadness.nl/downloads/xscreenshot.c
// Doesn't work, outputs "corrupted" png file
Saving xlib XImage to PNG // I don't want to use Cairo
Related
I have a couple of multispectral satellite images which are in .img/.rrd format and I want to oopen them in Matlab for further processing.
I'm not sure Matlab can recognise .img /.rdd files directly, but you could try using ImageJ or Fiji to convert your .img files to one of the image formats that is accepted. e.g. tiff, png, bmp, jpeg. The list of accepted formats can be found by typing 'imformats' in the command line.
Is there a way to convert all TIFF images to PNG using windows console or any simple tool.
I renamed tags, but the problem now is file size. What are ways to compress files?
imagemagick, it's CLI tool for image manipulation available for most major operating systems including Windows http://www.imagemagick.org/script/download.php
It's very simple to use it
convert in.tiff out.png
To convert and scale by 50%:
convert in.tiff -resize 50% out.png
Here you can find full list of general commands
TinyPng is great to compress png files, you can try that.
www.tinypng.com
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.
I have a series of dicom images and did change the HUs in the images using MATLAB scripts, then I imported them in ImageJ for display. Then I realised I can modify the images using ImageJ gui (which much easier, just moving the mouse). However, when I saved the modified images in ImageJ, they were saved in tiff format.
My question is that, is there a way to save images in imageJ as dicom format ?
or is there away to convert tiff format to dicom using MATLAB ?
Any suggestion ?
You can convert tiff format to dicom with dicomwrite:
dicomwrite( imread('input_image.tif'), 'output_image.dcm')
The following plugins allow writing DICOM files directly from ImageJ:
DICOM Import and Export plugins
The Tudor DICOM Tools
I have to convert a .pdf file containing scanned images into .txt files. The tesseract ocr converts only images to .txt, but I need to first extract the .tif images and then convert it. Can anyone help me with this?
Use Imagemagick:
convert -density 600 input.pdf output.tif
Density is in DPI, from my experience 600 DPI works the best.