Re: Picture Madness

2018-04-30 Thread jdcryer--- via 4D_Tech
Cannon,

Re: 
> You can do this in code. For example, here is some code I use:

Many thanks.  That makes complete sense I had started to look at some of the 
other options but ran out of time for the day.  I will use this tomorrow.  

Thank you again, Dougie


**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Picture Madness

2018-04-30 Thread Cannon Smith via 4D_Tech
Hi Douglas,

You can do this in code. For example, here is some code I use:

GET PICTURE METADATA($gPicture;TIFF orientation;$lOrientation)
Case of 
   : ($lOrientation=1)  //Normal, no rotation needed

   : ($lOrientation=8)  //Left 90˚, so need to rotate right 90˚
  $gPicture:=Photo_Rotate ($gPicture;90)

   : ($lOrientation=3)  //Upside down, so rotate 180˚
  $gPicture:=Photo_Rotate ($gPicture;180)

   : ($lOrientation=6)  //Right 90˚, so need to rotate 270˚
  $gPicture:=Photo_Rotate ($gPicture;270)

   Else   //The other orientations are not supported. They involved flipping 
the image. Ever occur?

End case 


The Photo_Rotate method is as follows:

  //This method rotates a picture. While it will rotate the picture to
  //any angle, this method is really expecting it to rotate 90˚, 180˚,
  //or 270˚.

C_PICTURE($1;$gPicture)
C_REAL($2;$rDegrees)  //Expects 90, 180, or 270
C_PICTURE($0)

$gPicture:=$1
$rDegrees:=$2

C_LONGINT($lWidth;$lHeight)
C_TEXT($svgRef;$imageRef)

PICTURE PROPERTIES($gPicture;$lWidth;$lHeight)
$svgRef:=SVG_New ($lWidth;$lHeight)
$imageRef:=SVG_New_embedded_image ($svgRef;$gPicture;0;0;".jpeg")

If (($rDegrees=90) | ($rDegrees=270))
SVG_SET_TRANSFORM_ROTATE ($imageRef;$rDegrees;($lHeight/2);($lWidth/2))
SVG_SET_TRANSFORM_TRANSLATE 
($imageRef;(($lHeight-$lWidth)/2);(($lWidth-$lHeight)/2))
DOM SET XML 
ATTRIBUTE($svgRef;"height";String($lWidth);"width";String($lHeight))
Else   //180
SVG_SET_TRANSFORM_ROTATE ($imageRef;$rDegrees;($lWidth/2);($lHeight/2))
End if 

$0:=SVG_Export_to_picture ($svgRef)
SVG_CLEAR ($svgRef)

HTH.

--
Cannon.Smith
Synergy Farm Solutions Inc.
Hill Spring, AB Canada
403-626-3236




> On Apr 30, 2018, at 11:03 AM, Douglas Cryer via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> What I want to do is load the picture based on its file property dimensions 
> and not the EXIF property dimansions.  Is there anyway to do this in 4D code? 
>  I hope I have explained the issue correctly...

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Picture Madness

2018-04-30 Thread Douglas Cryer via 4D_Tech
I have a picture puzzle that I hope someone may be able to help me with.

We are doing the following:
C_PICTURE(vg_Picture)
READ PICTURE FILE("";vg_Picture)

To load a picture to a screen variable.  My colleague has complained that when 
he loads some pictures they as he puts it "lay down".  I got him to send me an 
example and what I found is that despite the image loading into every other 
application as portrait the image loads in 4D as landscape.

The OS (Windows and Mac) sees the file as 3056x4592 but when I examine the EXIF 
pixel x  & y dimensions they do confirm it is a landscape picture 4592x3056.  I 
can only assume that the image was originally landscape and was rotated at the 
OS level but the EXIF properties (which are read only) remained.

What I want to do is load the picture based on its file property dimensions and 
not the EXIF property dimansions.  Is there anyway to do this in 4D code?  I 
hope I have explained the issue correctly...

Regards,  Dougie


telekinetix Limited- J. Douglas Cryer
Phone : 01234 761759  Mobile : 07973 675 218
2nd Floor Broadway House, 4-6 The Broadway, Bedford MK40 2TE
Email : jdcr...@telekinetix.com  Web : http://www.telekinetix.com 


 



**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**