<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>image rotation on Conholdate Blog</title>
    <link>https://blog-qa.conholdate.com/de/tag/image-rotation/</link>
    <description>Recent content in image rotation on Conholdate Blog</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>de</language>
    <lastBuildDate>Wed, 07 Oct 2026 17:53:30 +0000</lastBuildDate><atom:link href="https://blog-qa.conholdate.com/de/tag/image-rotation/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Bild drehen in Java</title>
      <link>https://blog-qa.conholdate.com/de/total/rotate-image-in-java/</link>
      <pubDate>Wed, 07 Oct 2026 17:53:30 +0000</pubDate>
      
      <guid>https://blog-qa.conholdate.com/de/total/rotate-image-in-java/</guid>
      <description>Erfahren Sie, wie Sie PNG‑ und JPG‑Bilder in Java mit Conholdate.Total for Java drehen. Dieser Leitfaden führt durch die Einrichtung, ein Codebeispiel und die Rotationsoptionen.</description>
      <content:encoded><![CDATA[<p>Das programmatische Drehen von Bildern ist ein häufiger Bedarf beim Erstellen von Vorschaugeneratoren, Fotobearbeitungsprogrammen oder Dokumenten‑Workflows. <a href="https://products.conholdate.com/total/java/">Conholdate.Total for Java</a> bietet ein robustes SDK, das die Bildbearbeitung in Java‑Anwendungen unkompliziert macht. In diesem Leitfaden lernen Sie, wie Sie <a href="https://docs.fileformat.com/image/png/">PNG</a> und <a href="https://docs.fileformat.com/image/jpg/">JPG</a> Dateien drehen, Rotationsparameter konfigurieren und Metadaten erhalten, während die Bildqualität hoch bleibt.</p>
<h2 id="umgebungsvorbereitung---voraussetzungen-und-einrichtung">Umgebungsvorbereitung - Voraussetzungen und Einrichtung</h2>
<p>Bevor Sie beginnen, stellen Sie sicher, dass Sie Folgendes haben:</p>
<ul>
<li>Java 17 oder neuer installiert.</li>
<li>Eine IDE wie IntelliJ IDEA oder Eclipse.</li>
<li>Maven für die Abhängigkeitsverwaltung.</li>
</ul>
<p>Fügen Sie das Conholdate Maven-Repository und die SDK-Abhängigkeit zu Ihrer <code>pom.xml</code> hinzu:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-xml" data-lang="xml"><span style="display:flex;"><span><span style="color:#f92672">&lt;repositories&gt;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&lt;repository&gt;</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">&lt;id&gt;</span>conholdate-repo<span style="color:#f92672">&lt;/id&gt;</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">&lt;name&gt;</span>Conholdate Maven Repository<span style="color:#f92672">&lt;/name&gt;</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">&lt;url&gt;</span>https://repository.conholdate.com/repo/<span style="color:#f92672">&lt;/url&gt;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&lt;/repository&gt;</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">&lt;/repositories&gt;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">&lt;dependency&gt;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&lt;groupId&gt;</span>com.conholdate<span style="color:#f92672">&lt;/groupId&gt;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&lt;artifactId&gt;</span>conholdate-total<span style="color:#f92672">&lt;/artifactId&gt;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&lt;version&gt;</span>24.9<span style="color:#f92672">&lt;/version&gt;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">&lt;type&gt;</span>pom<span style="color:#f92672">&lt;/type&gt;</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">&lt;/dependency&gt;</span>
</span></span></code></pre></div><p>Laden Sie die neuesten SDK‑Binärdateien von der offiziellen Download‑Seite herunter: <a href="https://releases.conholdate.com/total/java/">Conholdate.Total for Java Download</a>. Sobald die Abhängigkeiten aufgelöst sind, können Sie Code schreiben, der Bilder dreht.</p>
<h2 id="bild-in-java-drehen-schrittfürschrittanleitung">Bild in Java drehen: Schritt‑für‑Schritt‑Anleitung</h2>
<h3 id="schritt-1-quell--und-zielpfade-laden">Schritt 1: Quell- und Zielpfade laden</h3>
<p>Definieren Sie die Eingabe‑ und Ausgabepfade der Dateien. Das SDK unterstützt sowohl PNG‑ als auch JPG‑Formate.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-java" data-lang="java"><span style="display:flex;"><span>String inputPath <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;input.jpg&#34;</span><span style="color:#f92672">;</span>
</span></span><span style="display:flex;"><span>String outputPath <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;output_rotated.jpg&#34;</span><span style="color:#f92672">;</span>
</span></span></code></pre></div><h3 id="schritt-2-initialisieren-des-konvertierungs-handlers-und-der-optionen">Schritt 2: Initialisieren des Konvertierungs-Handlers und der Optionen</h3>
<p>Erstellen Sie die Kernobjekte, die den Konvertierungsprozess steuern.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-java" data-lang="java"><span style="display:flex;"><span>ConversionHandler handler <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> ConversionHandler<span style="color:#f92672">();</span>
</span></span><span style="display:flex;"><span>ImageConvertOptions options <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> ImageConvertOptions<span style="color:#f92672">();</span>
</span></span></code></pre></div><h3 id="schritt-3-rotationswinkel-und-hintergrundfarbe-festlegen">Schritt 3: Rotationswinkel und Hintergrundfarbe festlegen</h3>
<p>Geben Sie an, um wie viele Grad das Bild gedreht werden soll, und die Füllfarbe für die leeren Ecken.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-java" data-lang="java"><span style="display:flex;"><span>options<span style="color:#f92672">.</span><span style="color:#a6e22e">setRotateAngle</span><span style="color:#f92672">(</span>90<span style="color:#f92672">);</span>               <span style="color:#75715e">// Rotate 90 degrees clockwise
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>options<span style="color:#f92672">.</span><span style="color:#a6e22e">setBackgroundColor</span><span style="color:#f92672">(</span>Color<span style="color:#f92672">.</span><span style="color:#a6e22e">WHITE</span><span style="color:#f92672">);</span>  <span style="color:#75715e">// Fill empty space with white
</span></span></span></code></pre></div><h3 id="schritt-4-zusätzliche-parameter-konfigurieren">Schritt 4: Zusätzliche Parameter konfigurieren</h3>
<p>Behalte die ursprünglichen Metadaten bei und definiere die <a href="https://docs.fileformat.com/image/jpeg/">JPEG</a> Qualität, wenn die Ausgabe JPG ist.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-java" data-lang="java"><span style="display:flex;"><span>options<span style="color:#f92672">.</span><span style="color:#a6e22e">setPreserveMetadata</span><span style="color:#f92672">(</span><span style="color:#66d9ef">true</span><span style="color:#f92672">);</span>
</span></span><span style="display:flex;"><span>options<span style="color:#f92672">.</span><span style="color:#a6e22e">setQuality</span><span style="color:#f92672">(</span>90<span style="color:#f92672">);</span> <span style="color:#75715e">// JPEG quality (0‑100)
</span></span></span></code></pre></div><h3 id="schritt-5-rotation-ausführen">Schritt 5: Rotation ausführen</h3>
<p>Rufen Sie die <code>convert</code>-Methode auf, um die Rotation anzuwenden und das Ergebnis zu schreiben.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-java" data-lang="java"><span style="display:flex;"><span>handler<span style="color:#f92672">.</span><span style="color:#a6e22e">convert</span><span style="color:#f92672">(</span>inputPath<span style="color:#f92672">,</span> outputPath<span style="color:#f92672">,</span> options<span style="color:#f92672">);</span>
</span></span><span style="display:flex;"><span>System<span style="color:#f92672">.</span><span style="color:#a6e22e">out</span><span style="color:#f92672">.</span><span style="color:#a6e22e">println</span><span style="color:#f92672">(</span><span style="color:#e6db74">&#34;Image rotated successfully: &#34;</span> <span style="color:#f92672">+</span> outputPath<span style="color:#f92672">);</span>
</span></span></code></pre></div><p>Weitere Details zur Klasse <code>ConversionHandler</code> finden Sie in der <a href="https://reference.conholdate.com/java/com/groupdocs/conversion/ConversionHandler.html">offiziellen API‑Referenz</a>.</p>
<h2 id="vollständiges-codebeispiel-bild-in-java-mit-conholdatetotal-drehen">Vollständiges Codebeispiel: Bild in Java mit Conholdate.Total drehen</h2>
<p>Das folgende Beispiel demonstriert den vollständigen Arbeitsablauf zum Drehen einer Bilddatei.</p>
<p>Dieses Beispiel zeigt, wie man ein JPG‑Bild um 90 Grad dreht und das Ergebnis speichert.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-java" data-lang="java"><span style="display:flex;"><span><span style="color:#f92672">import</span> com.groupdocs.conversion.ConversionHandler<span style="color:#f92672">;</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">import</span> com.groupdocs.conversion.options.convert.ImageConvertOptions<span style="color:#f92672">;</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">import</span> java.awt.Color<span style="color:#f92672">;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">public</span> <span style="color:#66d9ef">class</span> <span style="color:#a6e22e">RotateImageExample</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">public</span> <span style="color:#66d9ef">static</span> <span style="color:#66d9ef">void</span> <span style="color:#a6e22e">main</span><span style="color:#f92672">(</span>String<span style="color:#f92672">[]</span> args<span style="color:#f92672">)</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>        String inputPath <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;input.jpg&#34;</span><span style="color:#f92672">;</span>
</span></span><span style="display:flex;"><span>        String outputPath <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;output_rotated.jpg&#34;</span><span style="color:#f92672">;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">try</span> <span style="color:#f92672">(</span>ConversionHandler handler <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> ConversionHandler<span style="color:#f92672">())</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>            ImageConvertOptions options <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> ImageConvertOptions<span style="color:#f92672">();</span>
</span></span><span style="display:flex;"><span>            <span style="color:#75715e">// Rotation angle in degrees (positive = clockwise)
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>            options<span style="color:#f92672">.</span><span style="color:#a6e22e">setRotateAngle</span><span style="color:#f92672">(</span>90<span style="color:#f92672">);</span>
</span></span><span style="display:flex;"><span>            <span style="color:#75715e">// Background color for empty areas after rotation
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>            options<span style="color:#f92672">.</span><span style="color:#a6e22e">setBackgroundColor</span><span style="color:#f92672">(</span>Color<span style="color:#f92672">.</span><span style="color:#a6e22e">WHITE</span><span style="color:#f92672">);</span>
</span></span><span style="display:flex;"><span>            <span style="color:#75715e">// Preserve original metadata (EXIF, DPI, etc.)
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>            options<span style="color:#f92672">.</span><span style="color:#a6e22e">setPreserveMetadata</span><span style="color:#f92672">(</span><span style="color:#66d9ef">true</span><span style="color:#f92672">);</span>
</span></span><span style="display:flex;"><span>            <span style="color:#75715e">// Optional: for large images you can limit memory usage
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>            options<span style="color:#f92672">.</span><span style="color:#a6e22e">setQuality</span><span style="color:#f92672">(</span>90<span style="color:#f92672">);</span> <span style="color:#75715e">// JPEG quality (0-100)
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>
</span></span><span style="display:flex;"><span>handler<span style="color:#f92672">.</span><span style="color:#a6e22e">convert</span><span style="color:#f92672">(</span>inputPath<span style="color:#f92672">,</span> outputPath<span style="color:#f92672">,</span> options<span style="color:#f92672">);</span>
</span></span><span style="display:flex;"><span>            System<span style="color:#f92672">.</span><span style="color:#a6e22e">out</span><span style="color:#f92672">.</span><span style="color:#a6e22e">println</span><span style="color:#f92672">(</span><span style="color:#e6db74">&#34;Image rotated successfully: &#34;</span> <span style="color:#f92672">+</span> outputPath<span style="color:#f92672">);</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">}</span> <span style="color:#66d9ef">catch</span> <span style="color:#f92672">(</span>Exception e<span style="color:#f92672">)</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>            System<span style="color:#f92672">.</span><span style="color:#a6e22e">err</span><span style="color:#f92672">.</span><span style="color:#a6e22e">println</span><span style="color:#f92672">(</span><span style="color:#e6db74">&#34;Error during image rotation:&#34;</span><span style="color:#f92672">);</span>
</span></span><span style="display:flex;"><span>            e<span style="color:#f92672">.</span><span style="color:#a6e22e">printStackTrace</span><span style="color:#f92672">();</span>
</span></span><span style="display:flex;"><span>        <span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">}</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">}</span>
</span></span></code></pre></div><blockquote>
<p><strong>Hinweis:</strong> Dieses Codebeispiel demonstriert die Kernfunktionalität. Bevor Sie es in Ihrem Projekt verwenden, stellen Sie sicher, dass Sie alle Dateipfade und Konfigurationswerte an Ihre tatsächliche Umgebung anpassen, überprüfen Sie, dass alle erforderlichen Abhängigkeiten ordnungsgemäß installiert sind, und testen Sie gründlich in Ihrer Entwicklungsumgebung. Wenn Sie auf Probleme stoßen, lesen Sie bitte die <a href="https://docs.conholdate.com/java/">offizielle Dokumentation</a> oder wenden Sie sich an das <a href="https://forum.conholdate.com/c/total/5">Support-Team</a> für Unterstützung.</p>
</blockquote>
<h2 id="rotationsparameter-optionen-und-einstellungen">Rotationsparameter: Optionen und Einstellungen</h2>
<p>Das SDK bietet mehrere Optionen, um den Rotationsvorgang fein abzustimmen.</p>
<ul>
<li><strong>Rotate Angle</strong> - Bestimmt, um wie viele Grad das Bild gedreht wird. Positive Werte drehen im Uhrzeigersinn.</li>
</ul>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-java" data-lang="java"><span style="display:flex;"><span>options<span style="color:#f92672">.</span><span style="color:#a6e22e">setRotateAngle</span><span style="color:#f92672">(</span>90<span style="color:#f92672">);</span>
</span></span></code></pre></div><ul>
<li>
<p><strong>Background Color</strong> - Legt die Füllfarbe für die leeren Ecken fest, die nach einer Drehung erscheinen. Verwenden Sie einen beliebigen <code>java.awt.Color</code>-Wert.</p>
</li>
<li>
<p><strong>Metadaten beibehalten</strong> - Wenn aktiviert, werden <a href="https://docs.fileformat.com/image/exif/">EXIF</a> Daten, DPI und andere Metadaten in der Ausgabedatei beibehalten. Siehe die <a href="https://reference.conholdate.com/java/com/groupdocs/conversion/options/convert/ImageConvertOptions.html">ImageConvertOptions API</a> für weitere Details.</p>
</li>
<li>
<p><strong>Quality</strong> - Steuert die JPEG‑Komprimierungsqualität (0‑100). Höhere Werte erhalten mehr Details, erhöhen jedoch die Dateigröße.</p>
</li>
</ul>
<p>Passen Sie diese Einstellungen an die Anforderungen Ihrer Anwendung an, egal ob Sie verlustfreie PNG‑Ausgabe oder hochwertige JPG‑Ergebnisse benötigen.</p>
<h2 id="fazit">Fazit</h2>
<p>Das Drehen von Bildern in Java ist einfach, wenn Sie <a href="https://products.conholdate.com/total/java/">Conholdate.Total for Java</a> verwenden. Dieser Leitfaden führt Sie durch die erforderliche Einrichtung, eine detaillierte Schritt‑für‑Schritt‑Implementierung und die wichtigsten Konfigurationsoptionen, mit denen Sie Winkel, Hintergrund, Metadaten‑Erhaltung und Ausgabequalität steuern können. Denken Sie daran, für Produktionsbereitstellungen eine gültige Lizenz zu erwerben; Sie können die Preisoptionen unter <a href="https://purchase.conholdate.com/pricing/total/family/">https://purchase.conholdate.com/pricing/total/family/</a> einsehen oder eine temporäre Lizenz zum Testen unter <a href="https://purchase.conholdate.com/temporary-license/">https://purchase.conholdate.com/temporary-license/</a> erhalten. Mit dem integrierten SDK können Sie eine zuverlässige Bildrotation in jeden Java‑basierten Workflow einbinden.</p>
<h2 id="faqs">FAQs</h2>
<ul>
<li>
<p><strong>Wie kann ich eine Bilddatei in Java mit Conholdate.Total drehen?</strong><br>
Verwenden Sie die Klasse <code>ImageConvertOptions</code>, um den gewünschten Rotationswinkel festzulegen, und rufen Sie dann <code>handler.convert(inputPath, outputPath, options)</code> wie in den obigen Beispielen gezeigt auf.</p>
</li>
<li>
<p><strong>Kann ich sowohl PNG- als auch JPG-Bilder mit demselben Code drehen?</strong><br>
Ja, das SDK erkennt das Quellformat automatisch. Geben Sie die richtige Dateierweiterung im Eingabepfad an, und derselbe Code funktioniert sowohl für PNG als auch für JPG.</p>
</li>
<li>
<p><strong>Welche Optionen stehen zur Verfügung, um den Rotationsvorgang anzupassen?</strong><br>
Sie können den Rotationswinkel, die Hintergrundfarbe, die Ausgabequalität anpassen und wählen, ob Metadaten erhalten bleiben sollen. Weitere Informationen finden Sie in der <a href="https://reference.conholdate.com/java/com/groupdocs/conversion/options/convert/ImageConvertOptions.html">ImageConvertOptions API</a>.</p>
</li>
<li>
<p><strong>Benötige ich eine Lizenz, um diese Funktion in der Produktion zu verwenden?</strong><br>
Für die Nutzung in der Produktion ist eine gültige Lizenz erforderlich. Sie können eine temporäre Lizenz für die Evaluierung unter <a href="https://purchase.conholdate.com/temporary-license/">https://purchase.conholdate.com/temporary-license/</a> erhalten oder die vollständigen Preisinformationen unter <a href="https://purchase.conholdate.com/pricing/total/family/">https://purchase.conholdate.com/pricing/total/family/</a> einsehen.</p>
</li>
</ul>
<h2 id="mehr-lesen">Mehr lesen</h2>
<ul>
<li><a href="https://blog.conholdate.com/de/total/convert-onenote-to-image-in-java/">Onenote in Bild konvertieren in Java</a></li>
<li><a href="https://blog.conholdate.com/de/total/convert-excel-to-image-in-java/">Excel in Bild konvertieren in Java</a></li>
<li><a href="https://blog.conholdate.com/de/total/convert-word-to-image-in-java/">Word in Bild konvertieren in Java</a></li>
</ul>
]]></content:encoded>
    </item>
    
  </channel>
</rss>
