How do I print a JPEG ?

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
Happyrever
Posts: 55
Joined: Sat Sep 10, 2011 12:22 pm

How do I print a JPEG ?

Post by Happyrever » Sun Jan 29, 2012 5:53 pm

I have the following print statment
print card 2 from the topLeft of graphic "OuterRect" on card 2 to the bottomRight of graphic "OuterRect" on card 2
and I want to create a .jpg to a file instead.

Context:-
At the moment, a series of cards (with a constant and fixed print area smaller than the actual card) are printed to paper one after another.

I now need to generate a JPEG of this printed area instead and save it to file.

How can the line of code be changed to do this?

The file name and path can be assumed to be set up already and as each card is cycled through, the file name will be incremented by the code.

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: How do I print a JPEG ?

Post by jmburnod » Sun Jan 29, 2012 6:20 pm

Hi Happyrever,
I now need to generate a JPEG of this printed area instead and save it to file.
You can use export snapshot like this :

Code: Select all

put the rect of graphic "OuterRect" into tRect
export snapshot from rect tRect to file MyPathFile as JPEG -- MyPathFile is a valid path
Best regards

Jean-Marc
https://alternatic.ch

Happyrever
Posts: 55
Joined: Sat Sep 10, 2011 12:22 pm

Re: How do I print a JPEG ?

Post by Happyrever » Mon Jan 30, 2012 6:20 pm

Thank you for the answer, it needed a slight modification because although the coordinates were correct, they were taken from the graphic, but used in export as screen coordinates.
the alteration was this
export snapshot from rect tRect on card 1 to file MyPathFile & ".jpg" as JPEG

The ref to the card was key to the solution, because it applied the export back to card coordinates.
The card number only relates to this specific case and is not part of the problem.

Thank you very much jmburnod for the great help.

Post Reply