sogytots
sogytots

Reputation: 75

ghostscript 9.53.3 auto rotating images for some reason

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();

Upvotes: 0

Views: 272

Answers (1)

Jay Rohr
Jay Rohr

Reputation: 56

Try adding -dAutoRotatePages=/None

Upvotes: 0

Related Questions