Eichhorn18
Posts: 48
Joined: Wed Jan 17, 2018 9:52 am

scp transfer of .PNG photos---something doesn't work

Wed Aug 15, 2018 1:58 pm

Hi there,

I have captured some .PNG photos with the raspberry pi camera and am now trying to transfer them from the pi to my workstation which is running Windows 10. I'm using the command prompt from within the workstation and using the following line:

>scp [email protected][ip adress]:/home/pi/Desktop/folder/*.png C:/Users/Administrator/Desktop/folder/

The terminal asks for the password and then it says "scp?: /home/pi/Desktop/folder/*.png: No such file or directory"

The file is absolutely in the folder and I have verified this command works with JPEG photos in the same folder by simply changing the .PNG to .JPG. No issues with that file type but it doesn't like the PNG.

Has anyone encountered this issue or have any idea what I'm missing?

Thanks,

B.Goode
Posts: 6352
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: scp transfer of .PNG photos---something doesn't work

Wed Aug 15, 2018 2:28 pm

Maybe show us the result, on the RPi, of

Code: Select all

ls -al /home/pi/Desktop/folder/*.png 

Eichhorn18
Posts: 48
Joined: Wed Jan 17, 2018 9:52 am

Re: scp transfer of .PNG photos---something doesn't work

Wed Aug 15, 2018 2:41 pm

B.Goode wrote:
Wed Aug 15, 2018 2:28 pm
Maybe show us the result, on the RPi, of

Code: Select all

ls -al /home/pi/Desktop/folder/*.png 
[email protected]:~/Desktop/ge267/WORKING $ ls -al /home/pi/Desktop/ge267/WORKING/*.png
ls: cannot access '/home/pi/Desktop/ge267/WORKING/*.png': No such file or directory

n67
Posts: 788
Joined: Mon Oct 30, 2017 4:55 pm

Re: scp transfer of .PNG photos---something doesn't work

Wed Aug 15, 2018 2:50 pm

Well, that pretty much answers that, doesn't it?
"L'enfer, c'est les autres"

If a post offends you, just put that poster on your foes list, and be done with it (and with them).

To do otherwise, risks being banned.

Eichhorn18
Posts: 48
Joined: Wed Jan 17, 2018 9:52 am

Re: scp transfer of .PNG photos---something doesn't work

Wed Aug 15, 2018 2:54 pm

n67 wrote:
Wed Aug 15, 2018 2:50 pm
Well, that pretty much answers that, doesn't it?
I'm not sure it answers anything. I assure you there are three .PNG photos in that folder. I am looking at them in the folder on my desktop monitor.

B.Goode
Posts: 6352
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: scp transfer of .PNG photos---something doesn't work

Wed Aug 15, 2018 3:04 pm

Eichhorn18 wrote:
Wed Aug 15, 2018 2:54 pm
n67 wrote:
Wed Aug 15, 2018 2:50 pm
Well, that pretty much answers that, doesn't it?
I'm not sure it answers anything. I assure you there are three .PNG photos in that folder. I am looking at them in the folder on my desktop monitor.



The fact that there are "three .PNG photos in that folder" is exactly the point...

Retry with

Code: Select all

ls -al /home/pi/Desktop/folder/*.PNG

Or more generally -

Code: Select all

ls -al /home/pi/Desktop/folder/


Big Hint: Linux filenames are case-sensitive...

Eichhorn18
Posts: 48
Joined: Wed Jan 17, 2018 9:52 am

Re: scp transfer of .PNG photos---something doesn't work

Wed Aug 15, 2018 3:22 pm

Code: Select all

ls -al /home/pi/Desktop/folder/*.PNG
ls: cannot access '/home/pi/Desktop/ge267/WORKING/*.PNG': No such file or directory

Code: Select all

ls -al /home/pi/Desktop/folder/
[email protected]:~/Desktop/ge267/WORKING $ ls -al /home/pi/Desktop/ge267/WORKING/
total 54708
drwxr-xr-x 3 pi pi 4096 Aug 15 15:10 .
drwxr-xr-x 6 pi pi 4096 May 18 11:11 ..
drwxr-xr-x 3 pi pi 4096 Aug 15 14:35 code_vault
-rw-r--r-- 1 pi pi 13353515 Aug 15 14:36 samwise_image0001
-rw-r--r-- 1 pi pi 13306384 Aug 15 14:36 samwise_image0002
-rw-r--r-- 1 pi pi 13293890 Aug 15 14:36 samwise_image0003
-rw-r--r-- 1 pi pi 5337738 Aug 15 15:07 test_image00.jpeg
-rw-r--r-- 1 pi pi 5346333 Aug 15 15:07 test_image01
-rw-r--r-- 1 pi pi 5354253 Aug 15 15:07 test_image02

The PNG images are called 'samwise...'

User avatar
RaTTuS
Posts: 10061
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: scp transfer of .PNG photos---something doesn't work

Wed Aug 15, 2018 3:25 pm

Eichhorn18 wrote:
Wed Aug 15, 2018 3:22 pm

total 54708
drwxr-xr-x 3 pi pi 4096 Aug 15 15:10 .
drwxr-xr-x 6 pi pi 4096 May 18 11:11 ..
drwxr-xr-x 3 pi pi 4096 Aug 15 14:35 code_vault
-rw-r--r-- 1 pi pi 13353515 Aug 15 14:36 samwise_image0001
-rw-r--r-- 1 pi pi 13306384 Aug 15 14:36 samwise_image0002
-rw-r--r-- 1 pi pi 13293890 Aug 15 14:36 samwise_image0003
-rw-r--r-- 1 pi pi 5337738 Aug 15 15:07 test_image00.jpeg
-rw-r--r-- 1 pi pi 5346333 Aug 15 15:07 test_image01
-rw-r--r-- 1 pi pi 5354253 Aug 15 15:07 test_image02

The PNG images are called 'samwise...'
no they are not, they seemed to be called samwise_image000? no png at all
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

Eichhorn18
Posts: 48
Joined: Wed Jan 17, 2018 9:52 am

Re: scp transfer of .PNG photos---something doesn't work

Wed Aug 15, 2018 3:31 pm

no they are not, they seemed to be called samwise_image000? no png at all

If you examine the file by right clicking in a desktop environment and looking at properties the file type is reporting as "PNG IMAGE". That is what the properties says of the photo when viewed on the Raspberry Pi.

Interestingly I just copied the three PNG photos to a windows machine and the file type is not recognized. Windows says "Type of file: File "

So I used the picamera python library to capture these photos. Why would these come out as a PNG image on the raspberry pi and an unrecognized format by any other machine?

B.Goode
Posts: 6352
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: scp transfer of .PNG photos---something doesn't work

Wed Aug 15, 2018 3:45 pm

The file type and the filename are different and unrelated.

The simple fact is that you have no files in that folder that match the filename patterns *.PNG or *.png

You need to spend a little while getting acquainted with file naming and handling in a Linux system... This experience should be the perfect motivation.

Eichhorn18
Posts: 48
Joined: Wed Jan 17, 2018 9:52 am

Re: scp transfer of .PNG photos---something doesn't work

Wed Aug 15, 2018 4:14 pm

B.Goode wrote:
Wed Aug 15, 2018 3:45 pm
The file type and the filename are different and unrelated.

The simple fact is that you have no files in that folder that match the filename patterns *.PNG or *.png

You need to spend a little while getting acquainted with file naming and handling in a Linux system... This experience should be the perfect motivation.
I appreciate your comments, and agree with you. I do need to better familiarize myself with Linux.

I guess I am confused. In the python library picamera, the function capture.sequence() requires that the image format must be specified as an option "format='png' ". The first bit of code below did not work, but I've just rewritten it with your suggestion and (the second bit of code) now works and scp works to transfering them.

Code: Select all

camera.capture(filepath + '_image%04d' % i,format='png')

Code: Select all

camera.capture(filepath + '_image%04d.png' % i,format='png')

ghans
Posts: 7785
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: scp transfer of .PNG photos---something doesn't work

Wed Aug 15, 2018 4:53 pm

Windows tries to infer filetype from the file extension, which works most of the time.
Linux does not honor filename extension but uses "magic" (signatures inside the file).

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

n67
Posts: 788
Joined: Mon Oct 30, 2017 4:55 pm

Re: scp transfer of .PNG photos---something doesn't work

Wed Aug 15, 2018 5:08 pm

I guess I am confused. In the python library picamera, the function capture.sequence() requires that the image format must be specified as an option "format='png' ". The first bit of code below did not work, but I've just rewritten it with your suggestion and (the second bit of code) now works and scp works to transfering them.
The key here is, as a previous poster hinted, that there are two different variables floating around, and they are (almost) completely independent of each other. The two variables are:

1) File content (aka, "format")
and
2) File name, including extension

Convention is to always make these the same - as if they were a single variable - and your life will be much, much easier if you adhere to this convention, but Unix/Linux, for the most part, do not enforce that you do (adhere to the convention).

So, you can have a "png file" that has no extension. You can have a "png file" with an extension of ".jpg" - or whatever you like. But everything works a lot better if your "png file"s have the extension ".png".

So, as you have found out, in order for things to work as expected, you have to, essentially, tell Python twice that you are creating a "png file" - once in the filename template string (this is the part you omitted originally) and then again in the "format" part.

P.S. The one area of which I am aware that does (pretty much - yes, I know the nitpickers will find ways to argue this) enforce that filename extensions be what they should be is the gcc compiler suite.

P.P.S. I was reading somewhere about some kind of daemon or something for Unix systems that actually would enforce the convention. I.e., if you create a "png file", it will ensure that the file has the "png" extension. Further, if you rename that file to "something.jpg", the daemon would kick in and convert the file (in place) to the "jpg" format. This technology strikes me as "kewl" (in that manner of spelling the word), but not at all "the Unix way".
"L'enfer, c'est les autres"

If a post offends you, just put that poster on your foes list, and be done with it (and with them).

To do otherwise, risks being banned.

Heater
Posts: 9703
Joined: Tue Jul 17, 2012 3:02 pm

Re: scp transfer of .PNG photos---something doesn't work

Wed Aug 15, 2018 6:11 pm

Actually, the OP of this thread does not say anything about what the content of any give file actually is, no matter what it's name is. It's all about copying files with scp. scp does not know or care what the format/content of a file is. scp only cares that you get the file name correct. Then it will copy whatever bytes that file has. No matter the format or content.

Directory paths are important. Upper or lower case is important. File permissions are important. Format/content is not.

Eichhorn18
Posts: 48
Joined: Wed Jan 17, 2018 9:52 am

Re: scp transfer of .PNG photos---something doesn't work

Wed Aug 15, 2018 10:15 pm

n67 wrote:
Wed Aug 15, 2018 5:08 pm
I guess I am confused. In the python library picamera, the function capture.sequence() requires that the image format must be specified as an option "format='png' ". The first bit of code below did not work, but I've just rewritten it with your suggestion and (the second bit of code) now works and scp works to transfering them.
The key here is, as a previous poster hinted, that there are two different variables floating around, and they are (almost) completely independent of each other. The two variables are:

1) File content (aka, "format")
and
2) File name, including extension

Convention is to always make these the same - as if they were a single variable - and your life will be much, much easier if you adhere to this convention, but Unix/Linux, for the most part, do not enforce that you do (adhere to the convention).

So, you can have a "png file" that has no extension. You can have a "png file" with an extension of ".jpg" - or whatever you like. But everything works a lot better if your "png file"s have the extension ".png".
That's very helpful commentary. I appreciate you laying that out for me.
Heater wrote: Actually, the OP of this thread does not say anything about what the content of any give file actually is, no matter what it's name is. It's all about copying files with scp. scp does not know or care what the format/content of a file is. scp only cares that you get the file name correct. Then it will copy whatever bytes that file has. No matter the format or content.

Directory paths are important. Upper or lower case is important. File permissions are important. Format/content is not.
Thanks to you also. As you point out the file name is the critical bit with the extension which I was missing, and I now know that this is separate from format.

Cheers to everyone who commented.

Return to “Networking and servers”

Who is online

Users browsing this forum: No registered users and 12 guests