CSV to TIFF or PNG conversion
Moderators: XnTriq, helmut, xnview
-
- Posts: 6
- Joined: Fri Apr 08, 2022 1:25 pm
CSV to TIFF or PNG conversion
I have been trying to convert .csv files into .tiff or .png images.
I noticed XnConverter does not read .csv files, so I converted them to .ps and .prn. For that, I also installed Ghostscript as recommended.
However, I could not activate it on the XnConvert as indicated on the website, there is no option to do that through the path mentioned here:
https://www.xnview.com/wiki/index.php?title=Ghostscript
This is what I get (Fig. 1)
When trying to read the .ps or .prn files, I get the message that it is not a picture (Fig. 2)
I tried to do the opposite, too. I converted a .tiff image into a .csv and then a .ps, but it still does not recognize the files it created.
Could you help me find a solution for these conversions?
I noticed XnConverter does not read .csv files, so I converted them to .ps and .prn. For that, I also installed Ghostscript as recommended.
However, I could not activate it on the XnConvert as indicated on the website, there is no option to do that through the path mentioned here:
https://www.xnview.com/wiki/index.php?title=Ghostscript
This is what I get (Fig. 1)
When trying to read the .ps or .prn files, I get the message that it is not a picture (Fig. 2)
I tried to do the opposite, too. I converted a .tiff image into a .csv and then a .ps, but it still does not recognize the files it created.
Could you help me find a solution for these conversions?
You do not have the required permissions to view the files attached to this post.
-
- XnThusiast
- Posts: 4238
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: CSV to TIFF or PNG conversion
CSV as in Comma Separated Value?
Have you checked whether you are able to export CSV files to PDF format from any application you have that can view CSV files? If not, there are freeware utilities such as Cute PDF that can create a PDF file from any file that can be printed.
Are you able to open a simple vector format PDF file, such as a text page exported from Word as a PDF, to confirm that you can open valid PDF files in XnConvert as currently configured?
Otherwise, an online search 'convert csv pdf' might be productive, various online converters and other tools shown.
Edit:
Or, having the Camera RAW settings window open in your screenshot, are your CSV files a RAW format?
Have you checked whether you are able to export CSV files to PDF format from any application you have that can view CSV files? If not, there are freeware utilities such as Cute PDF that can create a PDF file from any file that can be printed.
Are you able to open a simple vector format PDF file, such as a text page exported from Word as a PDF, to confirm that you can open valid PDF files in XnConvert as currently configured?
Otherwise, an online search 'convert csv pdf' might be productive, various online converters and other tools shown.
Edit:
Or, having the Camera RAW settings window open in your screenshot, are your CSV files a RAW format?
-
- Posts: 6
- Joined: Fri Apr 08, 2022 1:25 pm
Re: CSV to TIFF or PNG conversion
1. CSV as in Comma Separated Value? -- Yes, that's right
2. Have you checked whether you are able to export CSV files to PDF format from any application you have that can view CSV files? If not, there are freeware utilities such as Cute PDF that can create a PDF file from any file that can be printed.
Are you able to open a simple vector format PDF file, such as a text page exported from Word as a PDF, to confirm that you can open valid PDF files in XnConvert as currently configured?
-- Yes, XnConvert is reading PFD files, but since I have a spreadsheet with thousands of numbers, converting to PDF is not really what I need. The only match I found between my csv file and XnConverter is ps or prn formats. And XnConverter is not reading them, so I cannot convert the csv into images.
2. Have you checked whether you are able to export CSV files to PDF format from any application you have that can view CSV files? If not, there are freeware utilities such as Cute PDF that can create a PDF file from any file that can be printed.
Are you able to open a simple vector format PDF file, such as a text page exported from Word as a PDF, to confirm that you can open valid PDF files in XnConvert as currently configured?
-- Yes, XnConvert is reading PFD files, but since I have a spreadsheet with thousands of numbers, converting to PDF is not really what I need. The only match I found between my csv file and XnConverter is ps or prn formats. And XnConverter is not reading them, so I cannot convert the csv into images.
-
- XnThusiast
- Posts: 4238
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: CSV to TIFF or PNG conversion
Its 'XnConvert' rather than 'XnConverter'...jlima.geol wrote: ↑Fri Apr 08, 2022 2:55 pm Yes, XnConvert is reading PDF files, but since I have a spreadsheet with thousands of numbers, converting to PDF is not really what I need. The only match I found between my csv file and XnConverter is ps or prn formats. And XnConverter is not reading them, so I cannot convert the csv into images.

My thinking was that if you could convert the CSV files to PDF, you would then have a format that XnConvert could read when you set a suitable DPI value in the settings.
But how would you want the output, if XnConvert could read the ps or prm format files you have, and mightn't you be able get that result using PDF files?
I don't know how many files you have to convert, possibly quite a lot I imagine, but I would expect you to possibly be able to convert selected cells in Excel to a PDF file, as you have possibly saved a selection of cells to CSV?
Alternatively, could you use screenshots to create the image files you need?
Edit:
LibreOffice Calc can export to PNG (or JPEG) format, but I haven't found a way of exporting only a selection: from memory of a previous test involving exporting a selection to CSV, I think MS Excel might well be able to do that.
-
- Posts: 6
- Joined: Fri Apr 08, 2022 1:25 pm
Re: CSV to TIFF or PNG conversion
Ops, my mistake XD
The problem with the PDF is that it contains many pages with the numbers from the CSV and this is not what I want because the conversion does not produce an image. The CSV file contains pixel values for the image, in high resolution (almost 5,000 rows and columns) which I need to be read and return an image as an output. This happens when I convert a TIFF image to a CSV file (which will contain the pixels).
I attached here the output that I want. It is an image with low resolution. The high resolution I only have on the CSV.
Another problem is that my CSV has numbers from 0 to 6, not the RBG numbers that I want. I would also have to find a way to convert these numbers into RBG.
The problem with the PDF is that it contains many pages with the numbers from the CSV and this is not what I want because the conversion does not produce an image. The CSV file contains pixel values for the image, in high resolution (almost 5,000 rows and columns) which I need to be read and return an image as an output. This happens when I convert a TIFF image to a CSV file (which will contain the pixels).
I attached here the output that I want. It is an image with low resolution. The high resolution I only have on the CSV.
Another problem is that my CSV has numbers from 0 to 6, not the RBG numbers that I want. I would also have to find a way to convert these numbers into RBG.
You do not have the required permissions to view the files attached to this post.
-
- XnThusiast
- Posts: 4238
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: CSV to TIFF or PNG conversion
I sometimes like a challenge, but I'm not finding it easy to understand the detailed problem.
Do you have to start from the CSV file, rather than whatever source material, such as an Excel chart, that it was created from?
I'm also confused by your references to images in the CSV file, which is presumably a text file: could you explain the overall problem in a little more detail. Presumably you can't easily make an example file from which you are working available?
Edit:
It might be helpful if you could post a small example of the content of the CSV file, does it possibly contain the path to the large images you refer to and their pixel dimensions?
Do you have to start from the CSV file, rather than whatever source material, such as an Excel chart, that it was created from?
I'm also confused by your references to images in the CSV file, which is presumably a text file: could you explain the overall problem in a little more detail. Presumably you can't easily make an example file from which you are working available?
Edit:
It might be helpful if you could post a small example of the content of the CSV file, does it possibly contain the path to the large images you refer to and their pixel dimensions?
-
- Posts: 6
- Joined: Fri Apr 08, 2022 1:25 pm
Re: CSV to TIFF or PNG conversion
Hunn... Sorry, it's hard for me to explain because I've never worked with these conversions before... =/
The CSV file was created by a scanning electron microscope that generated an image from a rock sample. The image is its chemical composition in the form of a map. I exported a low-resolution image as TIFF and the high-resolution data, only available as a CSV file with the values of the pixels that represent that map. To better work with this data, I need to convert the CSV into another TIFF, which I presume will have a higher resolution than the one I got from the machine (with a much lower size).
I am attaching here an original low-resolution TIFF image and the PDF file I could convert it to using the XnConvert (I cannot attach a CSV here, so I just created a PDF from the CSV I got with XnConvert). That CSV (and the PDF) contains the pixels of that image/map.
What I need is the opposite. To convert the CSV I have from the equipment into a TIFF that gives me that exact same image but with a better resolution.
Thus, in that case, a PDF does not do the job since I don't need pages of numbers, but that map instead.
The CSV file was created by a scanning electron microscope that generated an image from a rock sample. The image is its chemical composition in the form of a map. I exported a low-resolution image as TIFF and the high-resolution data, only available as a CSV file with the values of the pixels that represent that map. To better work with this data, I need to convert the CSV into another TIFF, which I presume will have a higher resolution than the one I got from the machine (with a much lower size).
I am attaching here an original low-resolution TIFF image and the PDF file I could convert it to using the XnConvert (I cannot attach a CSV here, so I just created a PDF from the CSV I got with XnConvert). That CSV (and the PDF) contains the pixels of that image/map.
What I need is the opposite. To convert the CSV I have from the equipment into a TIFF that gives me that exact same image but with a better resolution.
Thus, in that case, a PDF does not do the job since I don't need pages of numbers, but that map instead.
You do not have the required permissions to view the files attached to this post.
-
- XnThusiast
- Posts: 4238
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: CSV to TIFF or PNG conversion
You should be able to if you place it in a ZIP archive, subject to the current forum attachment size limit of 2MiB, otherwise you would have to upload the file somewhere and post a download link. If the file is very large maybe you could post a small illustrative sample.
Thinking about it, I suspect that you would need to open the CSV file in Excel, maybe do some processing on the data such as reducing the dimensions of the image pixel data matrix, then either export the processed image data matrix as a matrix and add whatever data is needed to create a valid TIFF file, or maybe do that within Excel. To batch process images you would probably need to use one or more VBA Excel scripts. That would require knowledge of the TIFF file format, which is no doubt available online. So not exactly trivial!I exported a low-resolution image as TIFF and the high-resolution data, only available as a CSV file with the values of the pixels that represent that map. To better work with this data, I need to convert the CSV into another TIFF, which I presume will have a higher resolution than the one I got from the machine (with a much lower size).
With regard to the size of the new higher resolution TIFFs, TIFF files are generally large even when one of the compression options are applied, but if the image data is black and white, or can be accepted converted to bllack and white, much smaller file sizes are possible using suitable compression options.
I see that someone has already downloaded your attachments, maybe they can contribute!

-
- XnThusiast
- Posts: 4238
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: CSV to TIFF or PNG conversion
Note that my previous post has been edited twice!
-
- Moderator & Librarian
- Posts: 6404
- Joined: Sun Sep 25, 2005 3:00 am
- Location: Ref Desk
Re: CSV to TIFF or PNG conversion
This is beyond the scope of XnView, I'm afraid.jlima.geol wrote: ↑Sat Apr 09, 2022 6:32 pmThe CSV file was created by a scanning electron microscope that generated an image from a rock sample. The image is its chemical composition in the form of a map. I exported a low-resolution image as TIFF and the high-resolution data, only available as a CSV file with the values of the pixels that represent that map. To better work with this data, I need to convert the CSV into another TIFF, which I presume will have a higher resolution than the one I got from the machine (with a much lower size).
- Wikipedia: Energy-dispersive X-ray spectroscopy
- Carleton College SERC: Element(al) Mapping
- image.sc Forum: Napari Plugin to display csv as image
- napari: Getting started
- Digital Surf: MountainsSEM
- EDAX: APEX
- Oxford Instruments: AZtec (user manual)
-
- Posts: 6
- Joined: Fri Apr 08, 2022 1:25 pm
Re: CSV to TIFF or PNG conversion
Yeah, this sounds really complicatedThinking about it, I suspect that you would need to open the CSV file in Excel, maybe do some processing on the data such as reducing the dimensions of the image pixel data matrix, then either export the processed image data matrix as a matrix and add whatever data is needed to create a valid TIFF file, or maybe do that within Excel. To batch process images you would probably need to use one or more VBA Excel scripts. That would require knowledge of the TIFF file format, which is no doubt available online. So not exactly trivial!

I asked in the lab about this problem and they suggested the ImageJ, which reads the CSV directly into an image. That worked well for what I needed.
Thank you very much for your patience!


-
- Posts: 6
- Joined: Fri Apr 08, 2022 1:25 pm
Re: CSV to TIFF or PNG conversion
Indeed, I was using the AZtec to export the data but then could not work with it with the same software.This is beyond the scope of XnView, I'm afraid.
But thank you anyway!

-
- Moderator & Librarian
- Posts: 6404
- Joined: Sun Sep 25, 2005 3:00 am
- Location: Ref Desk
Re: CSV to TIFF or PNG conversion
Thanks for reporting back, jlima.geol (-:jlima.geol wrote: ↑Mon Apr 11, 2022 8:16 amIndeed, I was using the AZtec to export the data but then could not work with it with the same software.