Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues in getting image from the Foscam #2

Open
MartinPolytech opened this issue Apr 24, 2020 · 8 comments
Open

Issues in getting image from the Foscam #2

MartinPolytech opened this issue Apr 24, 2020 · 8 comments

Comments

@MartinPolytech
Copy link

Hello again ! First thanks for the help with the other issue !

I would like to get an image from the foscam camera. I found your SnapPicture method but as I saw that we only get the http line to access to the image with an explorer.
I read the foscam class and I feel like this is the only method to get an image, am I right ? If not what would be the other option.
Moreover I tried this method and I just got some unreadalble characters :

image

Kind regards,

Martin

@hypothermic
Copy link
Owner

Hello,

The snapPicture() method returns the raw JPEG image data in a string. Printing the string to the commandline will result in the unreadable characters as your screenshot shows. This is normal.

What do you want to do with the picture? Display it in the application or save it to a file? If you want to do the latter, simply open a FileOutputStream and write the result of snapPicture() into the stream. Here's a quick example:

Screenshot from 2020-04-24 16-59-05

Here's a link to the official documentation by Foscam, see function snapPicture2.

@swapnill93
Copy link

I also tried this , it did not help Sir. Can not get image from snapPicture

@swapnill93
Copy link

Hello again ! First thanks for the help with the other issue !

I would like to get an image from the foscam camera. I found your SnapPicture method but as I saw that we only get the http line to access to the image with an explorer.
I read the foscam class and I feel like this is the only method to get an image, am I right ? If not what would be the other option.
Moreover I tried this method and I just got some unreadalble characters :

image

Kind regards,

Martin

Did you have any luck getting the image?

@hypothermic
Copy link
Owner

Hello, which camera model and firmware version do you have? Please make sure you've upgraded o the latest firmware, because there was a bug across multiple camera versions a while back which caused the method to return HTML data instead of JPEG (ref 1, 2).

Unfortunately I am only able to test FoscamAPI on my FI9900P because that's the only camera I own. The snapPicture() method works fine with my camera, so I cannot resolve this issue. I would appreciate pull requests though if you have fixed the issue. Thanks.

@swapnill93
Copy link

Hello, which camera model and firmware version do you have? Please make sure you've upgraded o the latest firmware, because there was a bug across multiple camera versions a while back which caused the method to return HTML data instead of JPEG (ref 1, 2).

Unfortunately I am only able to test FoscamAPI on my FI9900P because that's the only camera I own. The snapPicture() method works fine with my camera, so I cannot resolve this issue. I would appreciate pull requests though if you have fixed the issue. Thanks.

F9800 is the model number.
Yes the firmware is updated to the latest version. I have another F9900 camera I will try it with that . Thanks

@swapnill93
Copy link

swapnill93 commented May 27, 2020 via email

@hypothermic
Copy link
Owner

Also, is there an option to set the ip address of camera to static? Thanks.

Foscam foscam = new Foscam("192.168.0.180", 88, "user", "passwd");

// Get current IP configuration
IPConfig ipConfig = foscam.getIPConfig();

ipConfig.isDHCP = false;
ipConfig.ip = "192.168.0.190"; // your new static IP;

// Set the new values
foscam.setIPConfig(ipConfig);

The camera will automatically reboot after setIPConfig(...) so make sure you set the right IP.

@swapnill93
Copy link

swapnill93 commented Jun 20, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants