Bilder zerschneiden, stichwort: SLICE

Kassel

Aktives Mitglied
Hi Community,

ich habe eine Frage bezüglich des zerschneidens von Bildern. Und zwar möchte ich ein Bild laden, z.B: 300x300 Groß und dann möchte ich ein Rechteckiges Stück dass sich bei der Position (100,20)(150,30) befindet Rausschneiden und als .jpeg speichern. Wie würde das gehen ?? oder gibt es schon fertige librarys die das erledigen ?

um (100,20)(150,30) zu erklären ,
x1=100, y1=20
x2=150, y2=30
also es sollte ein 50 pixel breites und 10 pixel grosses Bild ergeben

danke im voraus
 
was ist dein Ziel in diesem Forum, du stellst das Problem und alle anderen tragen die Lösung zusammen?
du hast doch ein klar definiertes Thema, führe dazu Suchen wie 'java bild ausschneiden' aus und finde erstmal viele Links die stundenlang zu lesen sind?
 
Ui, scheinbar funktionieren verlinkungen innerhalb von Websites nicht ganz hier (Mein link sollte zu #getSubimage scrollen)
getSubimage

public BufferedImage getSubimage(int x,
int y,
int w,
int h)

Returns a subimage defined by a specified rectangular region. The returned BufferedImage shares the same data array as the original image.

Parameters:
x - the X coordinate of the upper-left corner of the specified rectangular region
y - the Y coordinate of the upper-left corner of the specified rectangular region
w - the width of the specified rectangular region
h - the height of the specified rectangular region
Returns:
a BufferedImage that is the subimage of this BufferedImage.
Throws:
RasterFormatException - if the specified area is not contained within this BufferedImage.
So funktionierts
 
Zuletzt bearbeitet:

Neue Themen


Zurück
Oben