แปลง CGM เป็น PSD ผ่าน Java

ส่งออกไฟล์ CGM ไปยัง PSD ภายในแอปพลิเคชัน Java J2SE, J2EE, J2ME โดยไม่ต้องใช้ Adobe® Acrobat Reader

 

คุณสามารถแปลงไฟล์ cgm เป็นอิมเมจ PSD ใน Java ได้ในสองขั้นตอนง่ายๆ ประการแรก โดยใช้ Aspose.PDF for Java คุณสามารถส่งออก CGM เป็น JPEG ได้ หลังจากนั้น ด้วยการใช้ Aspose.Imaging for Java Image Processing API คุณสามารถแสดง JPEG เป็น PSD API ทั้งสองอยู่ภายใต้แพ็คเกจ Aspose.Total for Java

ส่งออก CGM เป็น PSD ผ่าน Java

  1. เปิดไฟล์ CGM โดยใช้คลาส Document
  2. เริ่มต้นวัตถุคลาส และแสดง CGM เป็น JPEG โดยใช้ [กระบวนการ]( https://reference.aspose.com/pdf/java/com.aspose.pdf.devices/JpegDevice#process-com aspose.pdf.Page-java.io.OutputStream-) วิธี
  3. โหลดไฟล์ JPEG โดยใช้คลาส Image
  4. บันทึกเอกสารในรูปแบบ PSD โดยใช้ บันทึก กระบวนการ

ข้อกำหนดการแปลง

คุณสามารถใช้ Aspose.Total สำหรับ Java ได้โดยตรงจากโปรเจ็กต์ที่ใช้ Maven และรวมไลบรารี่ไว้ใน pom.xml ของคุณ

หรือคุณสามารถรับไฟล์ ZIP จาก ดาวน์โหลด

// supports PDF, CGM, EPUB, TeX, PCL, PS, XPS, MD, MHTML, XSLFO, HTML file formats
// load PDF with an instance of Document
Document document = new Document("input.pdf");
// create an object of JpegDevice
JpegDevice renderer = new JpegDevice();
// convert first of a particular PDF page to JPEG format
renderer.process(document.getPages().get_Item(1), "output.jpeg");
// load JPEG file
Image image = Image.Load("output.jpeg");
// supports Dicom, Jpeg2000, Apng, Psd, Dxf, Wmf, Emz, Wmz, Tga, Svgz file formats
// save JPEG to PSD file format
image.save("output.psd", new PsdOptions());

แปลง CGM เป็น PSD ในไฟล์เดียวผ่าน Java

API ยังอนุญาตให้คุณส่งออกไฟล์ CGM ไปยัง PSD เป็นไฟล์เดียว ในการแปลงหน้าทั้งหมด ก่อนอื่น คุณสามารถแสดงเอกสาร CGM ของคุณเป็นไฟล์ TIFF หนึ่งไฟล์ และหลังจากนั้น คุณสามารถส่งออกไฟล์ TIFF ไปยัง PSD ได้ คุณสามารถเปิดไฟล์อินพุตได้โดยใช้คลาส Document และสร้างอ็อบเจ็กต์อุปกรณ์ Resolution, TiffSettings และ TIFF คุณสามารถรับภาพ TIFF เดียวได้โดยใช้ [กระบวนการ]( https://reference.aspose.com/pdf/java/com.aspose.pdf.devices/TiffDevice#process-com.aspose.pdf.IDocument-int-int- วิธี java.io.OutputStream-) ของคลาส TiffDevice สุดท้าย คุณสามารถโหลดไฟล์ TIFF โดยใช้คลาส Image และบันทึกเป็นรูปแบบ PSD โดยใช้ save apireference.aspose.com/imaging/java/com.aspose.imaging/Image#save-java.lang.String-com.aspose.imaging.ImageOptionsBase-) วิธี

// supports PDF, CGM, EPUB, TeX, PCL, PS, XPS, MD, MHTML, XSLFO, HTML file formats
// load PDF with an instance of Document
Document pdfDocument = new Document("input.pdf");
// Create Resolution object
Resolution resolution = new Resolution(300);
// Create TiffSettings object
TiffSettings tiffSettings = new TiffSettings();
tiffSettings.setCompression(CompressionType.None);
tiffSettings.setDepth(ColorDepth.Default);
tiffSettings.setShape(ShapeType.Landscape);
// Create TIFF device
TiffDevice tiffDevice = new TiffDevice(resolution, tiffSettings);
// Convert a particular page and save the image to stream
tiffDevice.process(pdfDocument, 1, 1, "output.tif");
// load TIFF file
Image image = Image.Load("output.tif");
// supports Dicom, Jpeg2000, Apng, Psd, Dxf, Wmf, Emz, Wmz, Tga, Svgz file formats
// save TIFF to PSD file format
image.save("output.psd", new PsdOptions());

แปลง CGM เป็น PSD ด้วยลายน้ำผ่าน Java

เมื่อใช้ API คุณยังสามารถส่งออกไฟล์ CGM ไปยัง PSD พร้อมลายน้ำในเอกสาร PSD ของคุณได้ ในการเพิ่มลายน้ำให้คุณสามารถแปลง CGM เป็น JPEG และเพิ่มลายน้ำได้ก่อน ในการเพิ่มลายน้ำ ให้โหลดไฟล์รูปภาพโดยใช้คลาส Image สร้างออบเจกต์ของ กราฟิก ://apireference.aspose.com/imaging/java/com.aspose.imaging/Graphics) และเริ่มต้นด้วยวัตถุ Image สร้าง Matrix ใหม่ com.aspose.imaging/Matrix) และตั้งค่าการแปลและการแปลงเป็นมุมที่ต้องการและเพิ่มลายน้ำโดยใช้ Graphics.drawString วิธี หลังจากเพิ่มลายน้ำลงในรูปภาพของคุณแล้ว คุณสามารถบันทึก JPEG เป็นรูปแบบ PSD ได้

// supports PDF, CGM, EPUB, TeX, PCL, PS, XPS, MD, MHTML, XSLFO, HTML file formats
// load PDF with an instance of Document
Document document = new Document("input.pdf");
// create an object of JpegDevice
JpegDevice renderer = new JpegDevice();
// convert first of a particular PDF page to JPEG format
renderer.process(document.getPages().get_Item(1), "output.jpeg");
// load JPEG
Image image = Image.load("output.jpeg");
// create and initialize an instance of Graphics class
Graphics graphics= new Graphics(image);
// create an instance of Font
Font font = new Font("Times New Roman", 16, FontStyle.Bold);
// create an instance of SolidBrush and set its properties
SolidBrush brush = new SolidBrush();
brush.setColor(Color.getBlack());
brush.setOpacity(100);
Size sz = graphics.getImage().getSize();
// create an object of Matrix class for transformation
Matrix matrix = new Matrix();
// first a translation then a rotation
matrix.translate(sz.getWidth() / 2, sz.getHeight() / 2);
matrix.rotate(-45.0f);
// set the Transformation through Matrix
graphics.setTransform(matrix);
// draw a string using the SolidBrush and Font objects at specific point
graphics.drawString("Watermark by Aspose.Imaging for Java", font, brush, 0, 0);
// supports Dicom, Jpeg2000, Apng, Psd, Dxf, Wmf, Emz, Wmz, Tga, Svgz file formats
// save JPEG to PSD file format
image.save("output.psd", new PsdOptions());

แปลงและหมุน CGM เป็นไฟล์ PSD ผ่าน Java

เมื่อใช้ API คุณยังสามารถหมุนอิมเมจ PSD ที่ส่งออกได้ตามความต้องการของคุณ วิธี Image.rotateFlip สามารถใช้หมุนภาพได้ 90/180/270 องศา แล้วพลิกภาพในแนวนอนหรือแนวตั้ง ไลบรารีมีวิธีการง่าย ๆ ในการดำเนินการที่ซับซ้อนในขณะที่ห่อหุ้มรายละเอียดที่น่าเกลียดทั้งหมดไว้ คุณสามารถระบุประเภทของการหมุนและพลิกเพื่อใช้กับรูปภาพได้ ในการหมุนและพลิกภาพ คุณสามารถโหลดภาพ JPEG ที่แปลงแล้วโดยใช้คลาส Image และเรียก Image วิธีrotatorFlipขณะระบุ RotateFlipType ที่เหมาะสม

// supports PDF, CGM, EPUB, TeX, PCL, PS, XPS, MD, MHTML, XSLFO, HTML file formats
// load PDF with an instance of Document
Document document = new Document("input.pdf");
// create an object of JpegDevice
JpegDevice renderer = new JpegDevice();
// convert first of a particular PDF page to JPEG format
renderer.process(document.getPages().get_Item(1), "output.jpeg");
// load JPEG file
Image image = Image.Load("output.jpeg");
// roate image
image.RotateFlip(RotateFlipType.Rotate270FlipNone);
// supports Dicom, Jpeg2000, Apng, Psd, Dxf, Wmf, Emz, Wmz, Tga, Svgz file formats
// save JPEG to PSD file format
image.save("output.psd", new PsdOptions());

สำรวจ CGM ตัวเลือกการแปลงด้วย Java

แปลง CGM S TO DOCM (ไฟล์ Microsoft Word 2007 Marco)
แปลง CGM S TO DOT (ไฟล์เทมเพลต Microsoft Word)
แปลง CGM S TO DOTM (ไฟล์เทมเพลต Microsoft Word 2007+)
แปลง CGM S TO DOTX (ไฟล์เทมเพลต Microsoft Word)
แปลง CGM S TO FLATOPC (โปรแกรมประมวลผลคำ Microsoft Word 2003ML)
แปลง CGM S TO GIF (รูปแบบการแลกเปลี่ยนกราฟิก)
แปลง CGM S TO MARKDOWN (ภาษามาร์กอัปที่มีน้ำหนักเบา)
แปลง CGM S TO MHTML (ไมม์ HTML)
แปลง CGM S TO ODT (รูปแบบไฟล์ข้อความ OpenDocument)
แปลง CGM S TO OTT (เทมเพลต OpenDocument)
แปลง CGM S TO PCL (ภาษาคำสั่งของเครื่องพิมพ์)
แปลง CGM S TO PS (ไฟล์โพสต์สคริปต์)
แปลง CGM S TO RTF (รูปแบบ Rich Text)
แปลง CGM S TO WORDML (โปรแกรมประมวลผลคำ Microsoft Word 2003ML)
แปลง CGM S TO XAMLFLOW (Power Automate ของ Microsoft)
แปลง CGM S TO CSV (ค่าที่คั่นด้วยเครื่องหมายจุลภาค)
แปลง CGM S TO DIF (รูปแบบการแลกเปลี่ยนข้อมูล)
แปลง CGM S TO EXCEL (รูปแบบไฟล์สเปรดชีต)
แปลง CGM S TO FODS (สเปรดชีต OpenDocument Flat XML)
แปลง CGM S TO MD (ภาษามาร์กดาวน์)
แปลง CGM S TO ODS (OpenDocument สเปรดชีต)
แปลง CGM S TO SXC (สเปรดชีตคำนวณ StarOffice)
แปลง CGM S TO TSV (ค่าที่คั่นด้วยแท็บ)
แปลง CGM S TO TXT (เอกสารข้อความ)
แปลง CGM S TO XLAM (Add-in ที่เปิดใช้งานแมโครของ Excel)
แปลง CGM S TO XLSB (สมุดงานไบนารีของ Excel)
แปลง CGM S TO XLSM (สเปรดชีตที่เปิดใช้งานมาโคร)
แปลง CGM S TO XLT (เทมเพลต Excel 97 - 2003)
แปลง CGM S TO XLTM (เทมเพลตที่เปิดใช้งานแมโครของ Excel)
แปลง CGM S TO XLTX (เทมเพลต Excel)
แปลง CGM S TO APNG (กราฟิกเครือข่ายแบบพกพาเคลื่อนไหว)
แปลง CGM S TO DICOM (การถ่ายภาพดิจิทัลและการสื่อสารทางการแพทย์)
แปลง CGM S TO DXF (รูปแบบการแลกเปลี่ยนการวาดของ Autodesk)
แปลง CGM S TO EMZ (Windows บีบอัด Enhanced Metafile)
แปลง CGM S TO JPEG2000 (รูปแบบภาพ J2K)
แปลง CGM S TO JPEG2000 (รูปแบบภาพ J2K)
แปลง CGM S TO ODP (รูปแบบการนำเสนอ OpenDocument)
แปลง CGM S TO OTP (รูปแบบมาตรฐาน OpenDocument)
แปลง CGM S TO POT (ไฟล์เทมเพลต Microsoft PowerPoint)
แปลง CGM S TO POTM (ไฟล์เทมเพลต Microsoft PowerPoint)