Best way to reduce image quality

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
hrcap
Posts: 101
Joined: Mon Jan 14, 2019 5:20 pm

Best way to reduce image quality

Post by hrcap » Thu Jun 10, 2021 11:54 pm

Evening All

I hope that everyone is well.

I am looking for a better way to reduce the quality of an image and thus reduce the number of Kilobytes that the image uses.

I currently:

- take a photo with the iPhone Camera using moblepickphoto
- Display the photo in LiveCode
- Reduce the dimensions of the photo... i.e. set height to y, set width to x
- Take a snapshot of the photo
- Save the snapshot to my Database

This does reduce the image Kilobytes (but not by much), and it also very quickly reduces the image quality to a sub-par level.


If I manually carry out the equivalent process using Preview on Mac I can make a much smaller kb image that is still of a relatively good quality.



If anyone can shed any light on a more efficient method to reduce image file size then it would be much appreciated.



Many Thanks

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8646
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Best way to reduce image quality

Post by FourthWorld » Fri Jun 11, 2021 3:10 am

Use the JPEGQuality property to control the file size and sharpness of JPEG files created with the export command.

JPEG compression is inherently lossy, which means some detail is always lost when an image is compressed using this method. The JPEGQuality property controls how much detail is lost. If the JPEGQuality is 100, as much detail as possible is retained.

In general, the lower the quality setting, the smaller the file size. Photographic images with naturally fuzzy edges generally do not suffer much visible loss of quality with a JPEGQuality setting of 50 or higher. Different images may require different levels of this property to achieve acceptable results.

The JPEGQuality setting is used when a file is exported in JPEG format using the export command, and when an image whose paintCompression property is "jpeg" is changed.
Richard Gaskin
LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”