Images files

Hi,
im not sure if this is the right forum to post it but anyway…

I build a program that take photos from camera/galery and upload it to my server.

actually its working just fine, but i’m having a problem with the images size.
the files are big and take a lot of time to upload(daaa… :slight_smile: ).
i need some way to manipulate the image file to reduce its size. i just want to resize the image file.
is there any way to do it?

Thanks for your help. [import]uid: 175991 topic_id: 35726 reply_id: 335726[/import]

Please help… [import]uid: 175991 topic_id: 35726 reply_id: 142342[/import]

Hi @admin531,
Can you explain in more detail the process (and a bit of code) on how you’re currently implementing this process? If users can see some code, they generally can help diagnose an issue better.

Thanks,
Brent [import]uid: 200026 topic_id: 35726 reply_id: 142520[/import]

Hi,

the problem is that i dont know how to code it :slight_smile:

let me explain it again:
lets say i have an image file on the device, the image size is 2000X2000 px.
i want to resize the image to 1000X1000 px and save it on the device.
[import]uid: 175991 topic_id: 35726 reply_id: 142847[/import]

You could try something like this:

  
-- Half the image size  
myImage.width = myImage.width / 2  
myImage.height = myImage.height / 2  
  
display.save( myImage, "myImage.jpg" )  

That should work, however I have not tested it. [import]uid: 84637 topic_id: 35726 reply_id: 142852[/import]

there is a problem with that…

if the image is out of screen bounds its bean cropped.

any other solution? or i have to buy the enterprise and do it myself with a plugin? [import]uid: 175991 topic_id: 35726 reply_id: 142988[/import]

Hi @admin531,
The screen capture functions like “display.save()” take into account the bounds of the screen. So, if your image (sections of it) are off screen after the “.width / 2” and “.height / 2” operation, you’ll still get the outlying parts chopped off, as you’ve seen. You might try doing some quick math to calculate the longest side of the image, reduce that dimension to the size of the screen, and then use the same ratio to scale the other dimension (so it doesn’t become disproportional). Then save and upload that file.

Brent [import]uid: 200026 topic_id: 35726 reply_id: 143025[/import]

Please help… [import]uid: 175991 topic_id: 35726 reply_id: 142342[/import]

Hi @admin531,
Can you explain in more detail the process (and a bit of code) on how you’re currently implementing this process? If users can see some code, they generally can help diagnose an issue better.

Thanks,
Brent [import]uid: 200026 topic_id: 35726 reply_id: 142520[/import]

Hi,

the problem is that i dont know how to code it :slight_smile:

let me explain it again:
lets say i have an image file on the device, the image size is 2000X2000 px.
i want to resize the image to 1000X1000 px and save it on the device.
[import]uid: 175991 topic_id: 35726 reply_id: 142847[/import]

You could try something like this:

  
-- Half the image size  
myImage.width = myImage.width / 2  
myImage.height = myImage.height / 2  
  
display.save( myImage, "myImage.jpg" )  

That should work, however I have not tested it. [import]uid: 84637 topic_id: 35726 reply_id: 142852[/import]

there is a problem with that…

if the image is out of screen bounds its bean cropped.

any other solution? or i have to buy the enterprise and do it myself with a plugin? [import]uid: 175991 topic_id: 35726 reply_id: 142988[/import]

Hi @admin531,
The screen capture functions like “display.save()” take into account the bounds of the screen. So, if your image (sections of it) are off screen after the “.width / 2” and “.height / 2” operation, you’ll still get the outlying parts chopped off, as you’ve seen. You might try doing some quick math to calculate the longest side of the image, reduce that dimension to the size of the screen, and then use the same ratio to scale the other dimension (so it doesn’t become disproportional). Then save and upload that file.

Brent [import]uid: 200026 topic_id: 35726 reply_id: 143025[/import]

Hi,

the problem is that i dont know how to code it :slight_smile:

let me explain it again:
lets say i have an image file on the device, the image size is 2000X2000 px.
i want to resize the image to 1000X1000 px and save it on the device.
[import]uid: 175991 topic_id: 35726 reply_id: 142847[/import]

You could try something like this:

  
-- Half the image size  
myImage.width = myImage.width / 2  
myImage.height = myImage.height / 2  
  
display.save( myImage, "myImage.jpg" )  

That should work, however I have not tested it. [import]uid: 84637 topic_id: 35726 reply_id: 142852[/import]

there is a problem with that…

if the image is out of screen bounds its bean cropped.

any other solution? or i have to buy the enterprise and do it myself with a plugin? [import]uid: 175991 topic_id: 35726 reply_id: 142988[/import]

Hi @admin531,
The screen capture functions like “display.save()” take into account the bounds of the screen. So, if your image (sections of it) are off screen after the “.width / 2” and “.height / 2” operation, you’ll still get the outlying parts chopped off, as you’ve seen. You might try doing some quick math to calculate the longest side of the image, reduce that dimension to the size of the screen, and then use the same ratio to scale the other dimension (so it doesn’t become disproportional). Then save and upload that file.

Brent [import]uid: 200026 topic_id: 35726 reply_id: 143025[/import]

Hi,

the problem is that i dont know how to code it :slight_smile:

let me explain it again:
lets say i have an image file on the device, the image size is 2000X2000 px.
i want to resize the image to 1000X1000 px and save it on the device.
[import]uid: 175991 topic_id: 35726 reply_id: 142847[/import]

You could try something like this:

  
-- Half the image size  
myImage.width = myImage.width / 2  
myImage.height = myImage.height / 2  
  
display.save( myImage, "myImage.jpg" )  

That should work, however I have not tested it. [import]uid: 84637 topic_id: 35726 reply_id: 142852[/import]

there is a problem with that…

if the image is out of screen bounds its bean cropped.

any other solution? or i have to buy the enterprise and do it myself with a plugin? [import]uid: 175991 topic_id: 35726 reply_id: 142988[/import]