Author Topic: Error when generating logos in PDF format  (Read 187132 times)

hjb2004

  • Administrator
  • with posts
  • *****
  • Posts: 5
    • View Profile
Error when generating logos in PDF format
« on: November 15, 2017, 05:36:00 pm »
Hi Xiang-Jun,

When I run these commands:

cd examples/MatrixREDUCE/spellman-alpha
sh commandline.sh
LogoGenerator -file=results/psam_001.xml -format=pdf

I get the following error:

GPL Ghostscript 9.19:

  ERROR:
    Can't set GraphicsAlphaBits or TextAlphaBits with a vector device.
Unrecoverable error: rangecheck in .putdeviceprops
system('gs -sOutputFile=./psam_001.pdf \
   -sDEVICE=pdfwrite \
   -dPDFSETTINGS=/printer \
   -dEmbedAllFonts=true \
   -dDEVICEWIDTHPOINTS=340 \
   -dDEVICEHEIGHTPOINTS=213 \
   -q -r96 -dTextAlphaBits=4 -dSAFER -dBATCH -dNOPAUSE \
   ./temp_logo.eps
') returns nonzero (65280)

The error seems to be triggered by the "-dTextAlphaBits=4" option. When I run "gs" manually without it, it work fine.

Seems that this is a known problem with more recent versions of "gs". I use version 9.19 on a Mac OS 10.11.6.

Thanks,
Harmen

xiangjun

  • Administrator
  • with posts
  • *****
  • Posts: 42
    • View Profile
Re: Error when generating logos in PDF format
« Reply #1 on: November 15, 2017, 06:07:43 pm »
Hi Harmen,

Thanks for posting on the Forum!

Yes, I can reproduce the error message with regard to generating the logos in PDF format. It is indeed due to the Ghostscript "-dTextAlphaBits=4" option you reported. I am using Ghostscript 9.21.

I remember taking the "-dTextAlphaBits=4" option from reading on the docs/examples somewhere. Now that we know the problem, we have the following options to go:

  • Simply remove the "-dTextAlphaBits=4" option from the system call.
  • Or we can remove the support of the PDF output format (from the documentation).

While we are here, I'd also want to remove the largely out-of-date GIF output format. By doing so, we also get rid of the dependency on the convert from ImageMagick.

What's your take? Please let me know, and I will update and code for a new release late tonight (or tomorrow).

Xiang-Jun

hjb2004

  • Administrator
  • with posts
  • *****
  • Posts: 5
    • View Profile
Re: Error when generating logos in PDF format
« Reply #2 on: November 15, 2017, 06:56:27 pm »
Hi Xiang-Jun,

PDF support seems important to keep, and removing the option "-dTextAlphaBits=4" from config/pkg_settings.cfg completely solved the problem for me for this format, so I can continue with what I was doing now.

However, I agree that it will be best to discontinue GIF support. On my Mac at least, "convert" is not installed by default, and indeed GIF generation with "-format=gif" does not work:

$ LogoGenerator -file=results/psam_001.xml -format=gif
sh: line 6: convert: command not found
system('gs -sOutputFile=- \
   -sDEVICE=png16m \
   -dDEVICEWIDTHPOINTS=340 \
   -dDEVICEHEIGHTPOINTS=213 \
   -q -r96 -dSAFER -dBATCH -dNOPAUSE \
   ./temp_logo.eps \
   | convert png:- ./psam_001.gif
') returns nonzero (32512)


Thanks for the quick response!

Harmen

xiangjun

  • Administrator
  • with posts
  • *****
  • Posts: 42
    • View Profile
Re: Error when generating logos in PDF format
« Reply #3 on: November 15, 2017, 07:04:41 pm »
Hi Harmen,

Thanks for your quick feedback.

I'll update the software code with 'gif' output removed, but keep the PDF option. A new release will be made available on the download page late tonight.

Best regards,

Xiang-Jun


xiangjun

  • Administrator
  • with posts
  • *****
  • Posts: 42
    • View Profile
Re: Error when generating logos in PDF format
« Reply #4 on: November 15, 2017, 11:09:40 pm »
As a followup, the REDUCE Suite has been updated to v2.2.4-2017nov16. The LogoGenerator bug for PDF output has been fixed. The obsolete GIF output has been removed to avoid a dependency on the convert program from ImageMagick. The default PNG format is the choice for use with HTMLSummary-generated webpage. The LogoGenerator documentation has been also revised.

Some examples:

Code: Ruby
  1. # By default, the output is in PNG format
  2. LogoGenerator -file=$REDUCE_SUITE/data/formats/psam_ex.dat -logo=sample.png
  3. # Using the -format=pdf option for PDF output
  4. LogoGenerator -file=$REDUCE_SUITE/data/formats/psam_ex.dat -logo=sample.pdf -format=pdf
  5. # Output in the raw EPS format with -format=eps
  6. LogoGenerator -file=$REDUCE_SUITE/data/formats/psam_ex.dat -logo=sample.eps -format=eps

The LogoGenerator utility in the REDUCE Suite is a general purpose, robust logo generator of DNA or RNA base sequences. It creates a logo in the vector EPS format, which can be easily converted to other vector or raster image format using numerous third-party tools. Internally, LogoGenerator takes advantage of the widely available gs program (Ghostscript).

It is worth noting that on Mac OS X, the preview program can directly read LogoGenerator-created EPS file and convert it to PDF format. On Linux and Windows, the situation should be similar.

Xiang-Jun
« Last Edit: November 15, 2017, 11:17:36 pm by xiangjun »

Rochford

  • with posts
  • *
  • Posts: 1
    • View Profile
Re: Error when generating logos in PDF format
« Reply #5 on: February 11, 2018, 08:59:59 am »
Hi Xiang, just a quick question, I can't directly read LogoGenerator-created EPS file on Linux. Am I missing something?

xiangjun

  • Administrator
  • with posts
  • *****
  • Posts: 42
    • View Profile
Re: Error when generating logos in PDF format
« Reply #6 on: February 11, 2018, 09:53:30 am »
Quote
I can't directly read LogoGenerator-created EPS file on Linux. Am I missing something?

Could you be more specific? Please provide a concrete example so I (and others) can reproduce what you failed to achieve.

Best regards,

Xiang-Jun

 

Created and maintained by Dr. Xiang-Jun Lu [律祥俊]. See also http://forum.x3dna.org and http://x3dna.org