1
$\begingroup$

When copying the Image from the hard drive to the Mathematica notebook, what can I do to have the path of the Image?

I tried Imort[img] // Path where img is Image but it didn't work.

$\endgroup$

1 Answer 1

4
$\begingroup$

You can use the name to find the path, but not the image variable.

name = "image.png"; img = Import[name] FindFile[name] 

FindFile finds the same file that Import finds. If you have another image with the same name in a different directory, by changing to that directory (with SetDirectory) Import and FindFile will find the second image.

$\endgroup$
6
  • $\begingroup$ I don't know the name, I just drag and drop the image to the notebook. $\endgroup$ Commented Jan 18, 2015 at 12:59
  • $\begingroup$ Then you have copied the image and the path information has gone. $\endgroup$ Commented Jan 18, 2015 at 13:06
  • $\begingroup$ So not to loose the path info, I need to import it not to copy? $\endgroup$ Commented Jan 18, 2015 at 13:08
  • $\begingroup$ Yes, that's the usual way. $\endgroup$ Commented Jan 18, 2015 at 13:15
  • $\begingroup$ In that case what is the point to use FindFile, if you know the name? $\endgroup$ Commented Jan 18, 2015 at 13:21

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.