Preview VS Export

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
propeller
Posts: 22
Joined: Sat Oct 13, 2018 12:22 pm

Preview VS Export

Post by propeller » Mon Oct 29, 2018 3:01 pm

Hi there,

i am doing my first steps and am in love with livecode already. i am working on my little project and need some strategic/logic input from you.

What i have: I have a group "Canvas", where two images are loaded "BackgroundImage" and "OVL" (which is a png with transparency - as overlay). I have a scrollbar which works to scale the image and i can drag the "BackgroundImage" around. With a button i can export the group as jpg. This is nice so far.

The idea behind the app is to have different canvases in the sizes of instagram-, facebook-, youtube-,... -post images. i want to load an image "BackgroundImage" which i scale and position the way that it looks nice on each canvas with the added overlay image. then i want to output all the files (for example FB-PostImage, IG-PostImage,...) with one button.

What goes through my brain at the moment is the following: My app will have a fixed size and i will have some kind of "Preview-Canvas" where the work is done. I will have buttons where i can switch canvasses. These will be smaller than the final image size but have the right aspect ratio of the image to be exported. For example my instagram canvas could be 400x400 pixels but the exported image will be lets say 1000x1000 (my loaded image is minimum this size or larger). of course i want to keep the original image-quality.

This is where my brain is stuck and hopes for your input. How can i create a preview-canvas to work on and export images in a larger size without loosing quality. My guess is to create some kind of an invisible export-canvas, which uses the export image dimensions and when i am done scaling and positioning in the preview, the export comes from the invisible export-canvas (which was manipulated by everything i did in the preview-canvas). Does this make any sense or do i need a different approach?

Have a nice day, you out there!

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Preview VS Export

Post by Klaus » Mon Oct 29, 2018 4:02 pm

Hi Propeller,

not sure I fully understand what you are trying to do, but we can also export a snapshot at a specific size:

Code: Select all

...
put specialfolderpath("desktop") & "/hollawind.jpg" into tFile
export snapshot from group "Canvas" at size 1000,1000 to file tFile as JPEG
...
Best

Klaus

propeller
Posts: 22
Joined: Sat Oct 13, 2018 12:22 pm

Re: Preview VS Export

Post by propeller » Mon Oct 29, 2018 4:25 pm

Hi Klaus. Thank you for your answer. This is interresting. I have to try this.

propeller
Posts: 22
Joined: Sat Oct 13, 2018 12:22 pm

Re: Preview VS Export

Post by propeller » Mon Oct 29, 2018 4:38 pm

Hello again, Klaus.

It works. I thought, exporting a resized snapshot would lead to reduced image quality but livecode seems to use the pixeldata from the original image - not from the scaled down in the canvas - to the quality stays the same. this is brillant!!! i tought this would be much more complicated to achive what i want. WOW.

i have to try on some more images to make sure that i do not loose quality this way.

Post Reply