Strange cropping behavior

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
giovanni_c
Posts: 52
Joined: Sat Sep 08, 2012 10:50 am

Strange cropping behavior

Post by giovanni_c » Wed Mar 13, 2019 4:14 pm

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
Attachments
samples.zip
(27.31 KiB) Downloaded 273 times

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Strange cropping behavior

Post by Klaus » Wed Mar 13, 2019 4:40 pm

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:
Bildschirmfoto 2019-03-13 um 16.38.10.jpg

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Strange cropping behavior

Post by jmburnod » Wed Mar 13, 2019 5:38 pm

Hi Klaus,
I get an other result (LC 9.01)
Best
Jean-Marc
Attachments
Capture d’écran 2019-03-13 à 17.34.03.png
https://alternatic.ch

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Strange cropping behavior

Post by Klaus » Wed Mar 13, 2019 5:52 pm

Yes, same here. 8)
But my screen shows an UNscaled image before and after cropping!
Looks like this (cropping an already scaled image) does in fact affect cropping.

giovanni_c
Posts: 52
Joined: Sat Sep 08, 2012 10:50 am

Re: Strange cropping behavior

Post by giovanni_c » Wed Mar 13, 2019 7:11 pm

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?

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Strange cropping behavior

Post by Klaus » Wed Mar 13, 2019 7:25 pm

Hi Giovanni,

yep, create a bug-report here:
https://quality.livecode.com


Best

Klaus

giovanni_c
Posts: 52
Joined: Sat Sep 08, 2012 10:50 am

Re: Strange cropping behavior

Post by giovanni_c » Thu Mar 14, 2019 9:27 am

Hi Klaus,
I filed a new bugreport:

https://quality.livecode.com/show_bug.cgi?id=21895

Thank you for your help and suggestions.

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Strange cropping behavior

Post by [-hh] » Sat Mar 16, 2019 11:44 am

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

Post Reply

Return to “Multimedia”