Strange cropping behavior
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 52
- Joined: Sat Sep 08, 2012 10:50 am
Strange cropping behavior
Hi everybody,
just want to ask you here if you are experiencing problems in cropping images.
My current experience in 9.0.x is that cropping an image will result in an image resizing instead of a proper cropping.
You can find attached to the post a stack in 3 different versions (7.0, 5.5 and 2.7).
The button in the stack will copy an image (PNG with transparency) on another image and will crop it at half height. In LC 9.x, 8.x, 7.x and 6.x I was able to try this operation will result in a resize, not crop. In an old LC 5.0.2 this will result in a proper cropping (this is why I loaded the stack in different version formats)
On an application, ported from an older version of LC to the latest one, I also noticed that the crop operation corrupt my PNGs, alterating the transparency and colours. Unfortunately I'm not able to replicate it on a new stack...
Can you help me to understand what's going on?
Thank you very much
just want to ask you here if you are experiencing problems in cropping images.
My current experience in 9.0.x is that cropping an image will result in an image resizing instead of a proper cropping.
You can find attached to the post a stack in 3 different versions (7.0, 5.5 and 2.7).
The button in the stack will copy an image (PNG with transparency) on another image and will crop it at half height. In LC 9.x, 8.x, 7.x and 6.x I was able to try this operation will result in a resize, not crop. In an old LC 5.0.2 this will result in a proper cropping (this is why I loaded the stack in different version formats)
On an application, ported from an older version of LC to the latest one, I also noticed that the crop operation corrupt my PNGs, alterating the transparency and colours. Unfortunately I'm not able to replicate it on a new stack...
Can you help me to understand what's going on?
Thank you very much
- Attachments
-
- samples.zip
- (27.31 KiB) Downloaded 278 times
Re: Strange cropping behavior
Buongiorno Giovanni,
not sure, but since you use an already scaled down image, this may cause the cropping to fail!?
If I use an image 1:1, everything looks like it should, and that means a correct cropped image, too.
See attached screen, please try it yourself!
Image on the left = 1:1 and the cropped doublette is also correct:
not sure, but since you use an already scaled down image, this may cause the cropping to fail!?
If I use an image 1:1, everything looks like it should, and that means a correct cropped image, too.
See attached screen, please try it yourself!
Image on the left = 1:1 and the cropped doublette is also correct:
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Strange cropping behavior
Hi Klaus,
I get an other result (LC 9.01)
Best
Jean-Marc
I get an other result (LC 9.01)
Best
Jean-Marc
https://alternatic.ch
Re: Strange cropping behavior
Yes, same here.
But my screen shows an UNscaled image before and after cropping!
Looks like this (cropping an already scaled image) does in fact affect cropping.
But my screen shows an UNscaled image before and after cropping!
Looks like this (cropping an already scaled image) does in fact affect cropping.
-
- Posts: 52
- Joined: Sat Sep 08, 2012 10:50 am
Re: Strange cropping behavior
Hi Klaus and jmburnod, first of all thank you for your replies.
Working on non-resized image actually change the behavior but in any case I have weird result (I.E. different resulting cropped image if I use breakpoints or not...).
Also I can see that if I crop the non-resized image and it's cropped properly, if I resize it back to the size that I need I have again wrong resulting image...
I think that this is a bug in the engine and I think that I will go to report it after other kind of investigation.
Have you got any suggestion about this?
Working on non-resized image actually change the behavior but in any case I have weird result (I.E. different resulting cropped image if I use breakpoints or not...).
Also I can see that if I crop the non-resized image and it's cropped properly, if I resize it back to the size that I need I have again wrong resulting image...
I think that this is a bug in the engine and I think that I will go to report it after other kind of investigation.
Have you got any suggestion about this?
-
- Posts: 52
- Joined: Sat Sep 08, 2012 10:50 am
Re: Strange cropping behavior
Hi Klaus,
I filed a new bugreport:
https://quality.livecode.com/show_bug.cgi?id=21895
Thank you for your help and suggestions.
I filed a new bugreport:
https://quality.livecode.com/show_bug.cgi?id=21895
Thank you for your help and suggestions.
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: Strange cropping behavior
You could try the following (cropping for scaled images):
Code: Select all
on mouseUp
lock messages; lock screen
if there is no img "bDup" then create img "bDup"
put img "background" into img "bDup"
put the rect of grc "destRect" into tR
set the rect of img "bDup" to tR
#-- set unscaled imagedata
set the imageData of img "bDup" to the imagedata of img "bDup"
#--
subtract (item 4 of tR-item 2 of tR) div 2 from item 4 of tR
crop img "bDup" to tR
unlock screen; unlock messages
end mouseUp
shiftLock happens