Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » JPEG Images do not get rotated correctly
Re: JPEG Images do not get rotated correctly [message #50372 is a reply to message #50371] Thu, 04 October 2018 14:33 Go to previous messageGo to previous message
Tom1
Messages: 1303
Registered: March 2007
Ultimate Contributor
Hi Oblivion,

Based on your findings, here's what needs to be done:
...
	Image rimg(r->GetImage());
	
	JPGRaster *jpg = dynamic_cast<JPGRaster*>(~r);
	if(jpg) {
		switch((int)jpg->GetMetaData("orientation")){
			// 1 = natural orientation
			case 2:
				rimg=MirrorHorz(rimg);
				break;
			case 3:
				rimg=Rotate180(rimg);
				break;
			case 4:
				rimg=MirrorVert(rimg);
				break;
			case 5:
				rimg=RotateAntiClockwise(MirrorHorz(rimg));
				break;
			case 6:
				rimg=RotateClockwise(rimg);
				break;
			case 7:
				rimg=RotateClockwise(MirrorHorz(rimg));
				break;
			case 8:
				rimg=RotateAntiClockwise(rimg);
				break;
		}
	}
	img.SetImage(rimg);
...


But how to embed it in plugin/jpg in the correct place so that it just works quietly in the background?

Best regards,

Tom
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: DrawArc not working in GTK mode
Next Topic: RescaleFilter.cpp: Implicit conversion from bool to double
Goto Forum:
  


Current Time: Wed Jun 25 09:56:10 CEST 2025

Total time taken to generate the page: 0.03611 seconds