ghostscript 9.53.3由于某些原因自动旋转图像

问题描述

我正在使用ghostsript版本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;
    // Process p1 = null;
    log.eventLow("Executing: " + shellCommand.toString());

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

解决方法

尝试添加-dAutoRotatePages = / None