Page 1 of 1

image capture on android devices

Posted: Tue Nov 12, 2013 9:14 pm
by GPJMA
Hello all.
I have been looking around the forum for some info on image capture on Android....most of what I find is a bit old.
Is anyone around the forum using live code successfully to capture images into an app?
I would appreciate any help in this area. Image capture on iOS is not a problem but I cant get it right with any Android device.
Thanks in anticipation
gpjma

Re: image capture on android devices

Posted: Wed Nov 13, 2013 2:15 am
by Mark
Hi gpjma,

A standard export snapshot command works. For example, something like this:

Code: Select all

on mouseUp
   createImage
end mouseUp

on createImage
   if there is an image "Test" then delete image "Test"
   export snapshot from this cd to myPict as PNG
   set the text of the templateImage to myPict
   put rescale(the formattedwidth of the templateImage,the formattedHeight of the templateImage,100,100) into myWH
   set the rect of the templateImage to 0,0 & comma & myWH
   set the loc of the templateImage to the loc of this cd
   set the showBorder of the templateImage to true
   set the name of the templateImage to "Test"
   create img
end createImage

function rescale theImgWidth,theImgHeight,theCdWidth,theCdHeight
  if theCdWidth/theImgWidth < theCdHeight/theImgHeight then
    put theCdWidth / theImgWidth into myRatio
  else
    put theCdHeight / theImgHeight into myRatio
  end if
  put theImgWidth * myRatio into myNewWidth
  put theImgHeight * myRatio into myNewHeight
  return myNewWidth,myNewHeight
end rescale
Many more variations are possible.

Kind regards,

Mark

Re: image capture on android devices

Posted: Wed Nov 13, 2013 8:48 am
by GPJMA
Hi Mark
Many thanks for the reply.
I have tried a few methods but have one issue or another.
My app requires the user to take a photo and log it with a report nothing too difficult I guess.
I will let you know how I get on.
Thanks again.
Grahame

Re: image capture on android devices

Posted: Wed Nov 13, 2013 10:16 am
by Mark
Hi Grahame,

I understand it now. You need access to the camera. That's something completely different from what I wrote of course. Doesn't the mobilePickMedia command work for you? Could you write a little more about what you have tried so far?+

Kind regards,

Mark

Re: image capture on android devices

Posted: Wed Nov 13, 2013 9:05 pm
by GPJMA
Hi Mark
Thanks.
Yes that's what I want to do but the code snippet you gave me will come in handy in another part of the program.
I will get back with what I am trying in a day or so as I am traveling between work sites at the moment.
Many thanks again for taking the time.
Cheers
Grahame