英文:
ghostscript 9.53.3 auto rotating images for some reason
问题
我正在使用ghostscript
版本9.53.3,我有一个eps
格式的图片。但是当我尝试将其转换为png
格式时,由于某种我不理解的原因,它会旋转它。
以下是我在Java中执行的命令,我通过执行进程并发送命令行参数来运行它:
[ "C:\\Program Files\\gs\\gs9.53.3\\bin\\gswin64.exe", -dNOPAUSE, -dEPSFitPage, -g88x88, -r300, -sDEVICE=png16m, -dGraphicsAlphaBits=4, -dBATCH, -sOutputFile=C:\\ProgramData\\InBetween\\Temp\\InBetweenClient\\IBTemp\\eps_12257004264254001602758322946eac07d9c-2366-49f1-bd2e-0181c1bef7ea.png", "D:\\Trunkcheckout\\IBClientServer\\bin\\..\\Projects\\myview_2356_VerpackungenPNG\\Images\\piktogramme/eps/2260_Erf_360.eps" ]
我的代码:
List<String> shellCommand = new ArrayList<String>();
if (isWindowOS) {
shellCommand.add("\"" + getGSPath() + "\"");
shellCommand.add("-dNOPAUSE");
shellCommand.add("-dEPSFitPage");
width = Unit.getPixelsFromPoints(width, dpi);
height = Unit.getPixelsFromPoints(height, dpi);
shellCommand.add("-g" + width + "x" + height);
shellCommand.add("-r" + dpi);
shellCommand.add("-sDEVICE=" + device);
if (GSUtilsInterface.DEVICE_PNG.equals(device)) {
shellCommand.add("-dGraphicsAlphaBits=4");
}
shellCommand.add("-dBATCH");
shellCommand.add("-sOutputFile=" + outputFile.toString());
shellCommand.add("\"" + imagePath + "\"");
} else {
shellCommand.add("pstopdf");
shellCommand.add(imagePath);
shellCommand.add("-o");
shellCommand.add(outputFile.toString());
}
log.debug("shellCommand:" + shellCommand);
InputStream in = null;
try {
Process p;
log.eventLow("Executing: " + shellCommand.toString());
if (isWindowOS) {
p = new ProcessBuilder(shellCommand).start();
英文:
I am using ghostsript
version 9.53.3, I have an eps
image. but when I try to convert it to png
, it rotates it for some reason I don't understand.
here is my command which I execute in java by executing process and sending commandline args:
["C:\Program Files\gs\gs9.53.3\bin\gswin64.exe", -dNOPAUSE, -dEPSFitPage, -g88x88, -r300, -sDEVICE=png16m, -dGraphicsAlphaBits=4, -dBATCH, -sOutputFile=C:\ProgramData\InBetween\Temp\InBetweenClient\IBTemp\eps_12257004264254001602758322946eac07d9c-2366-49f1-bd2e-0181c1bef7ea.png, "D:\Trunkcheckout\IBClientServer\bin\..\Projects\myview_2356_VerpackungenPNG\Images\piktogramme/eps/2260_Erf_360.eps"]
My code:
List<String> shellCommand = new ArrayList<String>();
if (isWindowOS) {
shellCommand.add("\"" + getGSPath() + "\"");
shellCommand.add("-dNOPAUSE");
shellCommand.add("-dEPSFitPage");
width = Unit.getPixelsFromPoints(width, dpi);
height = Unit.getPixelsFromPoints(height, dpi);
shellCommand.add("-g" + width + "x" + height);
shellCommand.add("-r" + dpi);
shellCommand.add("-sDEVICE=" + device);
if (GSUtilsInterface.DEVICE_PNG.equals(device)) {
shellCommand.add("-dGraphicsAlphaBits=4");
}
shellCommand.add("-dBATCH");
shellCommand.add("-sOutputFile=" +outputFile.toString());
shellCommand.add("\"" + imagePath + "\"");
} else {
shellCommand.add("pstopdf");
shellCommand.add(imagePath);
shellCommand.add("-o");
shellCommand.add(outputFile.toString());
}
log.debug("shellCommand:" + shellCommand);
InputStream in = null;
try {
Process p;
// Process p1 = null;
log.eventLow("Executing: " + shellCommand.toString());
if (isWindowOS) {
p = new ProcessBuilder(shellCommand).start();
答案1
得分: 0
尝试添加 -dAutoRotatePages=/None
英文:
Try adding -dAutoRotatePages=/None
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论