mirror of
				https://github.com/Frooodle/Stirling-PDF.git
				synced 2025-10-25 11:17:28 +02:00 
			
		
		
		
	PSD (#4146)
# Description of Changes <!-- Please provide a summary of the changes, including: - What was changed - Why the change was made - Any challenges encountered Closes #(issue_number) --> --- ## Checklist ### General - [ ] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [ ] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) (if applicable) - [ ] I have performed a self-review of my own code - [ ] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing) for more details.
This commit is contained in:
		
							parent
							
								
									6675a8af99
								
							
						
					
					
						commit
						71ac4283b2
					
				| @ -5,8 +5,11 @@ import java.awt.image.*; | ||||
| import java.io.IOException; | ||||
| import java.io.InputStream; | ||||
| import java.nio.ByteBuffer; | ||||
| import java.util.Iterator; | ||||
| 
 | ||||
| import javax.imageio.ImageIO; | ||||
| import javax.imageio.ImageReader; | ||||
| import javax.imageio.stream.ImageInputStream; | ||||
| 
 | ||||
| import org.springframework.web.multipart.MultipartFile; | ||||
| 
 | ||||
| @ -115,7 +118,34 @@ public class ImageProcessingUtils { | ||||
| 
 | ||||
|     public static BufferedImage loadImageWithExifOrientation(MultipartFile file) | ||||
|             throws IOException { | ||||
|         BufferedImage image = ImageIO.read(file.getInputStream()); | ||||
|         BufferedImage image = null; | ||||
|         String filename = file.getOriginalFilename(); | ||||
|          | ||||
|         if (filename != null && filename.toLowerCase().endsWith(".psd")) { | ||||
|             // For PSD files, try explicit ImageReader | ||||
|             Iterator<ImageReader> readers = ImageIO.getImageReadersByFormatName("PSD"); | ||||
|             if (readers.hasNext()) { | ||||
|                 ImageReader reader = readers.next(); | ||||
|                 try (ImageInputStream iis = ImageIO.createImageInputStream(file.getInputStream())) { | ||||
|                     reader.setInput(iis); | ||||
|                     image = reader.read(0); | ||||
|                 } finally { | ||||
|                     reader.dispose(); | ||||
|                 } | ||||
|             } | ||||
|             if (image == null) { | ||||
|                 throw new IOException("Unable to read image from file: " + filename +  | ||||
|                     ". Supported PSD formats: RGB/CMYK/Gray 8-32 bit, RLE/ZIP compression"); | ||||
|             } | ||||
|         } else { | ||||
|             // For non-PSD files, use standard ImageIO | ||||
|             image = ImageIO.read(file.getInputStream()); | ||||
|         } | ||||
|          | ||||
|         if (image == null) { | ||||
|             throw new IOException("Unable to read image from file: " + filename); | ||||
|         } | ||||
|          | ||||
|         double orientation = extractImageOrientation(file.getInputStream()); | ||||
|         return applyOrientation(image, orientation); | ||||
|     } | ||||
|  | ||||
| @ -91,7 +91,7 @@ dependencies { | ||||
|     // runtimeOnly "com.twelvemonkeys.imageio:imageio-pcx:$imageioVersion@ | ||||
|     // runtimeOnly "com.twelvemonkeys.imageio:imageio-pict:$imageioVersion" | ||||
|     // runtimeOnly "com.twelvemonkeys.imageio:imageio-pnm:$imageioVersion" | ||||
|     // runtimeOnly "com.twelvemonkeys.imageio:imageio-psd:$imageioVersion" | ||||
|     runtimeOnly "com.twelvemonkeys.imageio:imageio-psd:$imageioVersion" | ||||
|     // runtimeOnly "com.twelvemonkeys.imageio:imageio-sgi:$imageioVersion" | ||||
|     // runtimeOnly "com.twelvemonkeys.imageio:imageio-tga:$imageioVersion" | ||||
|     // runtimeOnly "com.twelvemonkeys.imageio:imageio-thumbsdb:$imageioVersion" | ||||
|  | ||||
| @ -601,12 +601,12 @@ rotate.tags=server side | ||||
| 
 | ||||
| 
 | ||||
| home.imageToPdf.title=Image to PDF | ||||
| home.imageToPdf.desc=Convert a image (PNG, JPEG, GIF) to PDF. | ||||
| imageToPdf.tags=conversion,img,jpg,picture,photo | ||||
| home.imageToPdf.desc=Convert a image (PNG, JPEG, GIF, PSD) to PDF. | ||||
| imageToPdf.tags=conversion,img,jpg,picture,photo,psd,photoshop | ||||
| 
 | ||||
| home.pdfToImage.title=PDF to Image | ||||
| home.pdfToImage.desc=Convert a PDF to a image. (PNG, JPEG, GIF) | ||||
| pdfToImage.tags=conversion,img,jpg,picture,photo | ||||
| home.pdfToImage.desc=Convert a PDF to a image. (PNG, JPEG, GIF, PSD) | ||||
| pdfToImage.tags=conversion,img,jpg,picture,photo,psd,photoshop | ||||
| 
 | ||||
| home.pdfOrganiser.title=Organise | ||||
| home.pdfOrganiser.desc=Remove/Rearrange pages in any order | ||||
|  | ||||
| @ -601,12 +601,12 @@ rotate.tags=server side | ||||
| 
 | ||||
| 
 | ||||
| home.imageToPdf.title=Image to PDF | ||||
| home.imageToPdf.desc=Convert a image (PNG, JPEG, GIF) to PDF. | ||||
| imageToPdf.tags=conversion,img,jpg,picture,photo | ||||
| home.imageToPdf.desc=Convert a image (PNG, JPEG, GIF, PSD) to PDF. | ||||
| imageToPdf.tags=conversion,img,jpg,picture,photo,psd,photoshop | ||||
| 
 | ||||
| home.pdfToImage.title=PDF to Image | ||||
| home.pdfToImage.desc=Convert a PDF to a image. (PNG, JPEG, GIF) | ||||
| pdfToImage.tags=conversion,img,jpg,picture,photo | ||||
| home.pdfToImage.desc=Convert a PDF to a image. (PNG, JPEG, GIF, PSD) | ||||
| pdfToImage.tags=conversion,img,jpg,picture,photo,psd,photoshop | ||||
| 
 | ||||
| home.pdfOrganiser.title=Organize | ||||
| home.pdfOrganiser.desc=Remove/Rearrange pages in any order | ||||
|  | ||||
| @ -602,11 +602,11 @@ rotate.tags=server side | ||||
| 
 | ||||
| home.imageToPdf.title=Irudia PDF bihurtu | ||||
| home.imageToPdf.desc=Irudi bat(PNG, JPEG, GIF)PDF bihurtu | ||||
| imageToPdf.tags=conversion,img,jpg,picture,photo | ||||
| imageToPdf.tags=conversion,img,jpg,picture,photo,psd,photoshop | ||||
| 
 | ||||
| home.pdfToImage.title=PDFa irudi bihurtu | ||||
| home.pdfToImage.desc=PDF bat irudi (PNG, JPEG, GIF) bihurtu | ||||
| pdfToImage.tags=conversion,img,jpg,picture,photo | ||||
| pdfToImage.tags=conversion,img,jpg,picture,photo,psd,photoshop | ||||
| 
 | ||||
| home.pdfOrganiser.title=Antolatzailea | ||||
| home.pdfOrganiser.desc=Ezabatu/Berrantolatu orrialdeak edozein ordenatan | ||||
|  | ||||
| @ -601,7 +601,7 @@ rotate.tags=pivoter,server side,rotate | ||||
| 
 | ||||
| 
 | ||||
| home.imageToPdf.title=Image en PDF | ||||
| home.imageToPdf.desc=Convertissez une image (PNG, JPEG, GIF) en PDF. | ||||
| home.imageToPdf.desc=Convertissez une image (PNG, JPEG, GIF, PSD) en PDF. | ||||
| imageToPdf.tags=pdf,conversion,img,jpg,image,photo | ||||
| 
 | ||||
| home.pdfToImage.title=PDF en image | ||||
|  | ||||
| @ -602,11 +602,11 @@ rotate.tags=server side | ||||
| 
 | ||||
| home.imageToPdf.title=画像をPDFに変換 | ||||
| home.imageToPdf.desc=画像 (PNG, JPEG, GIF) をPDFに変換します。 | ||||
| imageToPdf.tags=conversion,img,jpg,picture,photo | ||||
| imageToPdf.tags=conversion,img,jpg,picture,photo,psd,photoshop | ||||
| 
 | ||||
| home.pdfToImage.title=PDFを画像に変換 | ||||
| home.pdfToImage.desc=PDFを画像 (PNG, JPEG, GIF) に変換します。 | ||||
| pdfToImage.tags=conversion,img,jpg,picture,photo | ||||
| pdfToImage.tags=conversion,img,jpg,picture,photo,psd,photoshop | ||||
| 
 | ||||
| home.pdfOrganiser.title=整理 | ||||
| home.pdfOrganiser.desc=ページの削除/並べ替えします。 | ||||
|  | ||||
| @ -22,7 +22,7 @@ | ||||
|             <form id="imageToPDFForm" method="post" enctype="multipart/form-data" | ||||
|               th:action="@{'/api/v1/convert/img/pdf'}"> | ||||
|               <div | ||||
|                 th:replace="~{fragments/common :: fileSelector(name='fileInput', multipleInputsForSingleRequest=false, accept='image/*', inputText=#{imgPrompt})}"> | ||||
|                 th:replace="~{fragments/common :: fileSelector(name='fileInput', multipleInputsForSingleRequest=false, accept='image/*,.psd', inputText=#{imgPrompt})}"> | ||||
|               </div> | ||||
|               <div class="mb-3"> | ||||
|                 <label for="fitOption" th:text="#{imageToPDF.selectLabel}">Fit Options</label> | ||||
|  | ||||
| @ -58,7 +58,7 @@ repositories { | ||||
| 
 | ||||
| allprojects { | ||||
|     group = 'stirling.software' | ||||
|     version = '1.1.2' | ||||
|     version = '1.2.0' | ||||
| 
 | ||||
|     configurations.configureEach { | ||||
|         exclude group: 'commons-logging', module: 'commons-logging' | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user