# Import image saved as CSV file [closed]

I have saved my image file from ccd camera as a CSV file. How can I plot this file to get my image back? My file is here.

• Could you provide a ASCII file for test?
– yode
Mar 29 '17 at 6:45
• Mar 29 '17 at 7:00
• You may be wondering why this question got downvotes. Think about how the original version reads. It was simply "I have saved my image file from ccd camera as ASCII file. How can I plot this file to get my image back?". There was no link to the file, no explanation of the file format, and most importantly, no evidence that you made an attempt to solve the problem yourself before asking. Have you tried searching the documentation for "CSV" to see how to import this format? Mar 29 '17 at 8:54
• It is important to be aware that StackExchange is not a discussion forum. Questions should be asked in such a way to make them answerable without a lot of back and forth about what you really need. If you expect to get clarification questions, then the post is inappropriate. Mar 29 '17 at 8:56
• Related docs that answer your question: reference.wolfram.com/language/tutorial/ImageProcessing.html, reference.wolfram.com/language/ref/format/CSV.html Mar 29 '17 at 10:57

## 1 Answer

Mathematica is a toy more than a real tool for me, I'm glad to see you need it in your life. And I'm sorry you got those downvotes. In your case, you just:

data = Import["D:\\Downloads\\Idler_T_62_0001.ascii.csv"];
img=Image[Rescale[Most /@ data]]


You can save your image into your desktop by this code.

Export[FileNameJoin[{\$HomeDirectory,"\\Desktop","restore.png"}],img]

• Use Rescale to avoid clipping: Image[Rescale[Most /@ data], "Real"]. Mar 29 '17 at 8:20
• @AlexeyPopkov I'm confusing still.Since I have used "Real" or "Real32".I think it should not be clipped..
– yode
Mar 29 '17 at 8:39
• @AlexeyPopkov Unfortunately the documentation does not spell this out, but Real and "Real32" (i.e. floating point) types do not clip in Image. Integer pixel types do clip. It is unfortunate that this is not made clear in the documentation because it is one of the first things that is explained on WRI image processing seminars ... Mar 29 '17 at 8:57
• @AlexeyPopkov In my opinion, the description is accurate, but I do see why it is confusing, and I just submitted a suggestion to improve it. It says that values are displayed from 0..1, but it does not say that greater or smaller value are not stored. It says that values are coerced to the target type. This coercion necessitates clipping with integer types, but not (usually) with floating point type (unless you go above ~10^300). The same with rounding. Basically it says that M does whatever is needed to fit the value into the target type. Mar 29 '17 at 9:09
• So do you "toy around with tools" or "tool around with toys"? (Sorry, couldn't help it) :) - (+1) for the answer.
– gwr
Mar 30 '17 at 9:47