Page 1 of 2

Export snapshot ?

Posted: Wed Mar 10, 2021 11:00 pm
by bogs
I have a stack with a button with a blendlevel blendClear set like this...

Image

According to the dictionary, I should be able to export a snapshot of said button showing the effect of the blendLevel to a file, however I can't seem to get that to happen. The code so far is...

Code: Select all

export snapshot from button 1 of stack "s1" with effects to file "screenShot.png" as png
This is on linux using 6.x, however, it also didn't work in 9.6.x, so I don't think my decrepit IDE tendencies are the problem.

Any ideas what might be the problem?

Re: Export snapshot ?

Posted: Thu Mar 11, 2021 12:56 am
by Xero
This seems to have come up in the forum before:
viewtopic.php?t=30737
If you scroll down a bit, this code was used:

Code: Select all

put globalLoc(the topLeft of image 1) & "," & globalLoc(the bottomRight of image 1) into theArea
export snapshot from rect theArea to image 2
which would need to be adapted to what you are doing (button instead of image.

Code: Select all

put globalLoc(the topLeft of button 1 of stack "s1") & "," & globalLoc(the bottomRight of button 1 of stack "s1") into theArea
export snapshot from rect theArea to file "screenShot.png" as png
It seems that what needed to be done was capturing the screen by use of rectangle, instead of exporting the object directly. I didn't see why the object wouldn't just export with the effects, but it seems doing something tantamount to taking a screenshot of the object was the best work around...
XdM

Re: Export snapshot ?

Posted: Thu Mar 11, 2021 9:42 am
by Klaus
Took a while, but now I get it!

You are referring to the dictionary about SNAPSHOT, right:
...
# snapshot includes the object with blendLevel, ink, and graphic effects
import snapshot from button "myBtn" with effects
...
So your syntax is definitively correct!

Just made a test and it looks like INKs are not taken into account!?
The resulting image looked like the snapshotted button WITHOUT this INK set.
So maybe this is a bug?

Re: Export snapshot ?

Posted: Thu Mar 11, 2021 10:10 am
by richmond62
BlendLevels and Inks stopped being imported in snapshots a long time back.

See this:

viewtopic.php?f=10&t=30737

Re: Export snapshot ?

Posted: Thu Mar 11, 2021 12:28 pm
by Klaus
So it's another dcoumentation bug, sigh...

Re: Export snapshot ?

Posted: Thu Mar 11, 2021 1:31 pm
by bogs
@Xero -
Thank you for the link back to the previous thread, I had arrived at that thread last night and used it as a work around (my post came up in the search results heh, go figure), but globalLoc *works* because you are not using the control as the source. In other words, it is taking a screen shot of the screen, not your control.

This works, but doesn't answer the original question as to why 'with effects' doesn't translate literally as the dictionary suggests it should.

Cont'd. replying to Klaus...

@Klausimus :twisted:
I was referring exactly to the dictionary entry under export snapshot, i.e. <the parts emboldened and italicized>
description

Use the export snapshot command to export a screenshot to a file or container.

If you use the form export format to..., the selected image is exported. The export snapshot ... as paint form exports the image as a PBM, PGM, or PPM file, depending on the screen depth. (Optionally, you can specify a location for the mask file.) The export snapshot ... as JPEG form exports as a JPEG file, and the export snapshot ... as PNG form exports as a PNG file. If you do not specify a format, the file is exported as PBM, PGM, or PPM.

Using 'with' or 'without effects' specifies whether graphic effects and a blendLevel should be applied to the object before rendering export.
In all testing I did on this, I came to the conclusion you did, but if you check that discussion linked by Xero (and later Richmond heh), it is more than just an ink issue.

Image

On the left of the above screen shot is the original image, it has an outside glow applied for the drop shadow. Exporting that to the right side image, take a look at that drop shadow, it is literally a black outline of the glow effect, hardly worth the export. To boot, it reduced the size of the image fractionally as well.

I think this *is* a bug, and apparently a long standing one, but....

Cont'd. replying to Richmond...
... not exactly the way you mean. There was a fundamental shift in the way Lc past 2.7 treats blending, inks, etc compared to those versions prior to 2.7.

For instance, prior to 2.7, in Mc, blendlevels were applied almost solely to images, same with exporting. From 2.2 to 3, this was a changing thing, blending started applying to more objects the way it applied to images.

Image

I don't have the intervening 2.8 and 2.9 versions, but by 3.x the transition was more or less what we have today, where you could stick an object on a card, blend it so it made a hole in the card and you could see what was on the desktop in back to the degree you blended the object.

So, unless someone else can say why with effects doesn't work as billed, I think we are talking about either a bug in the engine <worst case>, or a bug in the dictionary description (which would be bad enough since this has been around since at least 2.7).

Any other thoughts?

Re: Export snapshot ?

Posted: Thu Mar 11, 2021 6:14 pm
by jacque
I'm confused. You are getting a snapshot of a clear transparent button with effects. Where did the car image come from? Is the button on top of it? If so, and you want to capture both at once, you need to use the rect syntax to get a screenshot.

If the purpose is to create a dropshadow on the image, the effects should be applied to the image itself. Then you can export a snapshot of the image with effects, which does work.

Re: Export snapshot ?

Posted: Thu Mar 11, 2021 8:37 pm
by bogs
jacque wrote:
Thu Mar 11, 2021 6:14 pm
I'm confused.
I have that effect on LOTS of people, don't feel all alone :twisted:

Xero, and later Richmond, linked to a previous thread involving similar subject matter which I had participated in, and used the above picture of the car as part of that topic.
jacque wrote:
Thu Mar 11, 2021 6:14 pm
If the purpose is to create a dropshadow on the image, the effects should be applied to the image itself.
The car image is an image object with its source set to that picture, and graphic effects applied, so you would *think* it would work just as you say, but you can see it obviously does not. That *does* work better now, however in at least 9.6, but still not dead on.

The button your referring too was blended clear so I could 'frame' a part of my desktop, like a screen shot program might. IF import/export snapshot is supposed to include the blendLevel, I was expecting to see a screen shot of the section of my desktop showing through the button. After all, that is what is in the space the button occupies.

Does that make more sense? Using the globalLoc and taking a screen shot shouldn't have to be done from what I take away from the dictionary, snapshot with effects shouldn't produce a shot of a button that has the card showing below it imho, it should do the same thing using globalLoc is doing if the object is showing whats behind the card.

Least, thats the way I read it, I could certainly be wrong.

Re: Export snapshot ?

Posted: Thu Mar 11, 2021 8:57 pm
by FourthWorld
On Ubuntu 20.04 both effects (innerGlow, outerGlow, innerShadow, outerShaddow, and colorOverlay) and blendLevel (which is not handled by the Skia effects subsystem and therefore not technically an "effect") output well as expected to PNG.

Output to JPEG cannot show transparency/"blendLevel" in either the image or any surrounding shadow/glow because the JPEG format specification provides no support for transparency.

JPEG was designed for photographs. PNG was designed to provide the transparency folks enjoy with GIF but with JPEG-like quality. JPEG offers more compression tailoring, but for most general purposes PNG is a good default choice for working with computer graphics.

Re: Export snapshot ?

Posted: Thu Mar 11, 2021 9:26 pm
by bogs
FourthWorld wrote:
Thu Mar 11, 2021 8:57 pm
and blendLevel (which is not handled by the Skia effects subsystem and therefore not technically an "effect")
Maybe you didn't catch the post preceeding Jacque's question, where I quoted the dictionary, but I'll quote here what *should* have stood out in the previous quote -
Using 'with' or 'without effects' specifies whether graphic effects and a blendLevel should be applied to the object before rendering export.
This has been in the dictionary since (roughly) 3.x, preceeding that, they called it 'ink'.

As to the output, I am pretty sure I *did* mention it was better than previously, but it is still far from a perfect reproduction.

I don't know why you would add that jpeg has no transparency, I wasn't exporting to jpg, nor did I mention jpg ?

20.04 isn't a supported OS yet, is it? You rebel, your going to be just like me some day, running on the wild side on completely unsupported OS'es :twisted:

Re: Export snapshot ?

Posted: Thu Mar 11, 2021 9:35 pm
by FourthWorld
bogs wrote:
Thu Mar 11, 2021 9:26 pm
FourthWorld wrote:
Thu Mar 11, 2021 8:57 pm
and blendLevel (which is not handled by the Skia effects subsystem and therefore not technically an "effect")
Maybe you didn't catch the post preceeding Jacque's question, where I quoted the dictionary, but I'll quote here what *should* have stood out in the previous quote -
Using 'with' or 'without effects' specifies whether graphic effects and a blendLevel should be applied to the object before rendering export.
This has been in the dictionary since (roughly) 3.x, preceeding that, they called it 'ink'.
For me the distinction is worth noting only for other purposes. For exports, blendLevel wortks (haven't tested/needed inks yet beyond the default of srcCopy).
20.04 isn't a supported OS yet, is it?
As they note in the Release Notes, "supported" only refers to their obligation to provide technical support, and doesn't describe any specific limit to what will or won't work with LC. It's just reasonable CYA for a world with 10,000 distros. Indeed, the paragraph after that lists fairly modest system requirements, which most modern GUI distros meet easily.

Re: Export snapshot ?

Posted: Thu Mar 11, 2021 9:50 pm
by bogs
FourthWorld wrote:
Thu Mar 11, 2021 9:35 pm
For exports, blendLevel works
I don't see it working here. Either that, or your interpretation of what should be in the final export isn't what I'm interpreting should be there.

Re: Export snapshot ?

Posted: Thu Mar 11, 2021 10:05 pm
by jacque
bogs wrote:
Thu Mar 11, 2021 8:37 pm
[The button your referring too was blended clear so I could 'frame' a part of my desktop, like a screen shot program might. IF import/export snapshot is supposed to include the blendLevel, I was expecting to see a screen shot of the section of my desktop showing through the button. After all, that is what is in the space the button occupies.
I see. That's not how it works. When you export an object (in this case, the button) then LC uses an internal buffer to render only that object. It's as if that were the only thing on the card. So you should be getting an image of a blank button with a dropshadow. Exporting a single control is useful if the control overlays other things and you don't want those other things in the snapshot.

If you want to see both the button and the underlying image, then you need a screenshot, using the rect of the area you want to capture.

Re: Export snapshot ?

Posted: Thu Mar 11, 2021 10:18 pm
by bogs
I'm sure I'll probably regret asking this, but what pray would be the purpose of something like that?

Re: Export snapshot ?

Posted: Thu Mar 11, 2021 10:24 pm
by richmond62
If you want to see both the button and the underlying image, then you need a screenshot, using the rect of the area you want to capture.
Not necessarily so: if you group the objects you want in your image you can then import/export a snapshot from the group.

Often, often, often I need a transparent field containing text that then has a drop shadow:

so, I make my field, give the text a drop shadow or an outer glow, group the field (Yes, in a group containing ONLY that field) and then
import a snapshot of that group. This guarantees consistency cross-platform in a way nothing else will.
-
SShot 2021-03-11 at 23.31.03.png