Export snapshot as jpeg has black border?[SOLVED]

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
ClipArtGuy
Posts: 253
Joined: Wed Aug 19, 2015 4:29 pm

Export snapshot as jpeg has black border?[SOLVED]

Post by ClipArtGuy » Wed Aug 19, 2015 4:39 pm

Hello! Is it possible to use a script like this:

Code: Select all

export snapshot from grp 1 to file (specialfolderpath("Desktop")&"/"MyTestIMG.jpg) as jpeg
WITHOUT the resulting file having a thin black border? If I export as PNG it makes this border transparent, which is OK, but I need my jpgs to not have a border also. I have "showborder" unchecked in property inspector of img 1.... The border appears in Ubuntu 64 bit and windows 7 using stable 7.0.6

Thanks!
Last edited by ClipArtGuy on Thu Aug 20, 2015 12:39 am, edited 1 time in total.

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

Re: Export snapshot as jpeg has black border?

Post by Klaus » Wed Aug 19, 2015 4:50 pm

HI ClipArtGuy,

1. welcome to the forum! :D

2. "export snapshot..." is usually working correctly and not adding anything to the resulting image!
Maybe your group has a tiny border? Sorry, just guessing...


Best

Klaus

ClipArtGuy
Posts: 253
Joined: Wed Aug 19, 2015 4:29 pm

Re: Export snapshot as jpeg has black border?

Post by ClipArtGuy » Wed Aug 19, 2015 5:13 pm

Hello Klaus,


Thanks for the fast reply!

This recipe produces an image with a border:

Create a new stack

1 - Create a new large rectangle image - uncheck "showborder" and fill with white

2 - Put a small graphic oval over the middle of img 1 (with a height and width much smaller than the first image)

3 - Group them together and run this in message box:

Code: Select all

export snapshot from grp 1  to file (specialfolderpath("Desktop")&"/MyTestImage.jpg") as jpeg
Every time I do this I get exactly what I would expect,but with a black border around the whole saved image that is a few pixels thick.
Can you confirm or deny that this happens for you? I have tested on Ubuntu and Windows with identical results using LiveCode 7.0.6

Thanks again!

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

Re: Export snapshot as jpeg has black border?

Post by Klaus » Wed Aug 19, 2015 5:23 pm

Hi ClipArtGuy,

yes, just tested on my Mac with LC 7.06 and also 6.7.7 and I alspo get this black border.
Great, a NEW bug :(


Best

Klaus

ClipArtGuy
Posts: 253
Joined: Wed Aug 19, 2015 4:29 pm

Re: Export snapshot as jpeg has black border?

Post by ClipArtGuy » Wed Aug 19, 2015 5:37 pm

It seems that when the group is created, The group is 2 pixels larger on all sides than the image. I am not sure if this is a bug or a feature....

ClipArtGuy
Posts: 253
Joined: Wed Aug 19, 2015 4:29 pm

Re: Export snapshot as jpeg has black border?

Post by ClipArtGuy » Wed Aug 19, 2015 5:47 pm

This script is working for me in a button now.

Code: Select all

on mouseUp
   set the height of grp 1 to (the width of grp 1 - 4)
   set the width of grp 1 to (the width of grp 1 - 4)
   set the loc of img 1 to the loc of grp 1
   export snapshot from grp 1  to file (specialfolderpath("Desktop")&"/MyTestImage.jpg") as jpeg
end mouseUp

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Export snapshot as jpeg has black border?

Post by FourthWorld » Wed Aug 19, 2015 6:15 pm

By default new groups have their margins property set to 4. You can change that before creation in the templateGroup, or after creation on the new group.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: Export snapshot as jpeg has black border?

Post by Klaus » Wed Aug 19, 2015 6:16 pm

Hi ClipArtGuy,

yes, true!

Looks like the MARGINS (Inspector for group -> Text formatting) of the group are causing this!
When set to 0 it works as advertised :D


Best

Klaus

ClipArtGuy
Posts: 253
Joined: Wed Aug 19, 2015 4:29 pm

Re: Export snapshot as jpeg has black border?[SOLVED]

Post by ClipArtGuy » Thu Aug 20, 2015 12:46 am

Thank you Klaus and Richard. Marked as solved!

Post Reply