ghostscript 9.53.3 自动旋转图像出现某些原因

huangapple go评论79阅读模式
英文:

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:

[&quot;C:\Program Files\gs\gs9.53.3\bin\gswin64.exe&quot;, -dNOPAUSE, -dEPSFitPage, -g88x88, -r300, -sDEVICE=png16m, -dGraphicsAlphaBits=4, -dBATCH, -sOutputFile=C:\ProgramData\InBetween\Temp\InBetweenClient\IBTemp\eps_12257004264254001602758322946eac07d9c-2366-49f1-bd2e-0181c1bef7ea.png, &quot;D:\Trunkcheckout\IBClientServer\bin\..\Projects\myview_2356_VerpackungenPNG\Images\piktogramme/eps/2260_Erf_360.eps&quot;]

My code:

List&lt;String&gt; shellCommand = new ArrayList&lt;String&gt;();

  if (isWindowOS) {
    shellCommand.add(&quot;\&quot;&quot; + getGSPath() + &quot;\&quot;&quot;);
    shellCommand.add(&quot;-dNOPAUSE&quot;);
    shellCommand.add(&quot;-dEPSFitPage&quot;);
    width = Unit.getPixelsFromPoints(width, dpi);
    height = Unit.getPixelsFromPoints(height, dpi);
    shellCommand.add(&quot;-g&quot; + width + &quot;x&quot; + height);
    shellCommand.add(&quot;-r&quot; + dpi);
    shellCommand.add(&quot;-sDEVICE=&quot; + device);
    if (GSUtilsInterface.DEVICE_PNG.equals(device)) {
      shellCommand.add(&quot;-dGraphicsAlphaBits=4&quot;);
    }
    shellCommand.add(&quot;-dBATCH&quot;);
    shellCommand.add(&quot;-sOutputFile=&quot; +outputFile.toString());
    shellCommand.add(&quot;\&quot;&quot; + imagePath + &quot;\&quot;&quot;);
  } else {
    shellCommand.add(&quot;pstopdf&quot;);
    shellCommand.add(imagePath);
    shellCommand.add(&quot;-o&quot;);
    shellCommand.add(outputFile.toString());
  }
  log.debug(&quot;shellCommand:&quot; + shellCommand);

  InputStream in = null;
  try {
    Process p;
    // Process p1 = null;
    log.eventLow(&quot;Executing: &quot; + shellCommand.toString());

    if (isWindowOS) {
      p = new ProcessBuilder(shellCommand).start();

答案1

得分: 0

尝试添加 -dAutoRotatePages=/None

英文:

Try adding -dAutoRotatePages=/None

huangapple
  • 本文由 发表于 2020年10月15日 19:48:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/64370939.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定