• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

Horizontal flip

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What's a simple way to flip an Image along the vertical or horizontal? I've searched high and low and surprised to find that I can't find something short and compact.

Thanks,
Edward.
 
MyExamCloud Software Support
Posts: 759
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use trigonometry to determine the correct width/height, using transparency to prevent the black area.

 
Edward Nunez
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Koilraj but I think you may have misinterpreted the question. I was looking for a way to mirror an image.
 
Greenhorn
Posts: 4
Python Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Following code contains a function that will take a BufferedImage and return a BufferedImage that is horizontally flipped:



If you are looking at vertically flipping an image, checkout the snippet below:



Hope this helps.
 
Rancher
Posts: 3325
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is some old code I found on the web a long time ago. It works for an Icon. It should also work for an image but I have never tested it:

 
Good night. Drive safely. Here's a tiny ad for the road:
Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders
https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing
reply
    Bookmark Topic Watch Topic
  • New Topic