This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 20 - Pages: 2 [ 1 2 | Next ] - Last Post: 29-Dec-2018 17:45 Last Post By: jGromit
jGromit

Posts: 8,630
Registered: 31-Jan-2006
FixedShapeFilter bug
Posted: 13-Apr-2015 14:43
 
  Click to reply to this thread Reply
Attachment fixedShapeBug.zip (291.4 KB)
The FixedShapeFilter is not being applied correctly. Attached is a zipped-up project with four images. Image bounds are set to 400x400. There's a user variable:
filter1 class=FixedShapeFilter closeups
In the final album, the slide pages all indicate that the slide images are 400x400. But open the output directory and take a look at the actual slide images - they're NOT all 400x400. They're all square, but they have different dimensions.

Adding prescale to the filter makes no difference.
jGromit

Posts: 8,630
Registered: 31-Jan-2006
Re: FixedShapeFilter bug
Posted: 13-Apr-2015 16:05   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
BTW, this bug afflicts thumbnails, as well. If you specify thumbnail bounds of 300x300 and invoke the FixedShapeFilter, you get thumbnails that are all square, but that are not all exactly 300x300 pixels. Oddly, it behaves properly if you drop back to 240x240 for the thumbs.
davidekholm

Posts: 3,859
Registered: 18-Oct-2002
Re: FixedShapeFilter bug
Posted: 13-Apr-2015 17:09   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
jAlbum has no support for the combination of "closeups" and "prescale" so it ends up ignoring "prescale". If we consider this a bug, it's actually a bug or limitation of jAlbum and not of the FixedShapeFilter. See the javadocs for JAFilter for the currently available "filter stages" that jAlbum maps combinations of the "closeups", "thumbnails" and "prescale" parameters to. I don't know whether we should complicate the filter pipeline further by allowing the combination of "prescale" and "closeups", but a warning message would at least help :-)
jGromit

Posts: 8,630
Registered: 31-Jan-2006
Re: FixedShapeFilter bug
Posted: 13-Apr-2015 17:13   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
I guess it boils down to a simple question:

In jAlbum, how can I generate slide images or thumbnails that are all exactly the same dimensions (the bounds)?

There doesn't seem to be any way to do it. As I posted above, even thumbnails are getting screwed up by this.
jGromit

Posts: 8,630
Registered: 31-Jan-2006
Re: FixedShapeFilter bug
Posted: 13-Apr-2015 17:18   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
And why is a slide page showing image dimensions of 400x400 for the slide image, when the actual JPG is 293x293 px? It's just grabbing ${imageWidth} and ${imageHeight}.
davidekholm

Posts: 3,859
Registered: 18-Oct-2002
Re: FixedShapeFilter bug
Posted: 13-Apr-2015 17:46   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
jGromit wrote:
And why is a slide page showing image dimensions of 400x400 for the slide image, when the actual JPG is 293x293 px? It's just grabbing ${imageWidth} and ${imageHeight}.

Yes, that seems to be an error. I'll look into that. To get FixedShapeFilter working as intended, either pass "prescale" only or "prescale" and "thumbnails".
jGromit

Posts: 8,630
Registered: 31-Jan-2006
Re: FixedShapeFilter bug
Posted: 13-Apr-2015 17:52   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
Here's another zipped-up example (too large for an attachment) that illustrates what a complete cock-up this is:

http://jgromit.jalbum.net/fsAgain.zip

The original image is huge, typical "straight out of the digital camera" size. I've specified 400x400 thumbnails, and told Minimal to create fixed-shape thumbnails (the Minimal init.bsh specifies prescale). The output thumbnail image is 335x335 pixels. Why? And the index page is showing a width and height for that image of 400px. Again, why?

The slide image bounds are 500x500. I've added a user variable to make the slide image a fixed shape, as well. The output slide image is 335x335 pixels. And the slide page is showing a width and height of 500px for that image file, which is simply wrong.
davidekholm

Posts: 3,859
Registered: 18-Oct-2002
Re: FixedShapeFilter bug
Posted: 13-Apr-2015 18:12   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Here's an updated FixedShapeFilter that generates correct width and height variables:
jGromit

Posts: 8,630
Registered: 31-Jan-2006
Re: FixedShapeFilter bug
Posted: 13-Apr-2015 18:37   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
That's an improvement.

But do you see what I'm really driving at, here? Take my last example (single large image). I've told it I want 400x400 thumbnails, fixed shape. It won't do it. But then it gets weird. If I change the image bounds (not the thumbnail bounds) from 500x500 to 640x640, the thumbnail is now 400px square, as it should be.

In short, the setting of the image bounds is having an effect on the thumbnail images. This is hardly what a user would expect!
jGromit

Posts: 8,630
Registered: 31-Jan-2006
Re: FixedShapeFilter bug
Posted: 14-Apr-2015 18:50   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
I think I can sum up the problem, here. The FixedShapeFilter is doing what it says it will do - it produces a thumbnail or slide image whose aspect ratio matches the aspect ratio of the image bounds. But the final dimensions of the image are almost unpredictable.

For a fixed shape thumbnail, I would expect the filter to crop the original image to the aspect ratio defined by the thumbnail bounds, then scale it. So if you set thumbnail bounds of 400x400, you would always get a 400x400 thumbnail as long as the original is at least 400x400 pixels.

The same would be true for a fixed shape slide image - crop to the aspect ratio of the slide image bounds, then scale. Again, as long as the originals were larger than the slide image bounds, the fixed shape slide images would all have the same dimensions.

That's clearly not what's happening. For slide images, it seems to be scaling, then cropping, rather than the other way around. For thumbnail images, I can't quite wrap my head around what it's doing. The final dimensions of the thumbnail image are affected by the slide image bounds, which shouldn't be related at all.
jGromit

Posts: 8,630
Registered: 31-Jan-2006
Re: FixedShapeFilter bug
Posted: 14-Nov-2017 14:01   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
An update: with all current betas applied - jAlbum 14.2b14, new CropFocus extension - the fixed shape behavior is still bizarre.

Specifying image bounds of 500x500 to a huge original image, with the fixed shape filter, produces a slide image that's 335x335.

Specifying thumbnail bounds of 400x400 produces a thumbnail that's also 335x335.

This makes no sense to me. Why do I not get a 500x500 slide and a 400x400 thumbnail?
davidekholm

Posts: 3,859
Registered: 18-Oct-2002
Re: FixedShapeFilter bug
Posted: 14-Nov-2017 15:02   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
jGromit wrote:
An update: with all current betas applied - jAlbum 14.2b14, new CropFocus extension - the fixed shape behavior is still bizarre.

Specifying image bounds of 500x500 to a huge original image, with the fixed shape filter, produces a slide image that's 335x335.

Specifying thumbnail bounds of 400x400 produces a thumbnail that's also 335x335.

This makes no sense to me. Why do I not get a 500x500 slide and a 400x400 thumbnail?


It's important that you apply the FixedShapeFilter BEFORE image scaling takes place. If you use the engine.addFilter API, pass JAFilter.ALL_PRESCALE_STAGE as stage for closeups and THUMBNAILS_PRESCALE_STAGE for thumbnails only
jGromit

Posts: 8,630
Registered: 31-Jan-2006
Re: FixedShapeFilter bug
Posted: 14-Nov-2017 15:28   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Sorry, but that makes no difference. In the zipped-up example, the skin is already using JAFilter.THUMBNAILS_PRESCALE_STAGE for thumbnails. The slide filter is in the user variables, and adding prescale to it doesn't change the behavior.

I still get 335x335 slide and thumbnail, despite image bounds of 500x500 and thumbnail bounds of 400x400 (the zipped example has 124x124 for thumbnail bounds, so change them for testing).
davidekholm

Posts: 3,859
Registered: 18-Oct-2002
Re: FixedShapeFilter bug
Posted: 14-Nov-2017 16:21   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
Is the trigger for this bug to feed a huge original?
jGromit

Posts: 8,630
Registered: 31-Jan-2006
Re: FixedShapeFilter bug
Posted: 14-Nov-2017 16:46   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Attachment bears1.jpg (73.2 KB)
No, it's even weirder than that. Add bears1.jpg to my zipped-up project. It's 600x450.

For the slide, I'd expect it to crop it square (450x450), then scale it to 500x500 bounds, yielding 450x450, since the image is actually smaller than the bounds. But it spits out a 375x375.

For the thumbnail, I'd expect it to crop it square (450x450), then scale it to 400x400 bounds, yielding 400x400. But it also produces a 375x375

The originally-included dv01.jpg is 3872x2592. That should crop square, to 2592x2592, then scale to 500x500 (for the slide) and to 400x400 (for the thumbnail). Both end up 335x335, even smaller than the bears1.jpg!

See why this has had me scratching my head?
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums