Summary: | autorotating EPS images | ||
---|---|---|---|
Product: | Ghostscript | Reporter: | durharam <durgaram.borkar> |
Component: | Images | Assignee: | Ray Johnston <ray.johnston> |
Status: | RESOLVED FIXED | ||
Severity: | major | ||
Priority: | P4 | ||
Version: | 9.53.3 | ||
Hardware: | PC | ||
OS: | All | ||
See Also: | https://bugs.ghostscript.com/show_bug.cgi?id=702607 | ||
Customer: | Word Size: | --- | |
Attachments: | this is the EP file, which when converted to png, is auto roteted |
Description
durharam
2020-10-16 11:20:00 UTC
please ignore the previous command which i had entered. this is the correct command: ["C:\Program Files\gs\gs9.52\bin\gswin64.exe", -dNOPAUSE, -dEPSFitPage, -g88x88, -r300, -sDEVICE=png16m, -dGraphicsAlphaBits=4, -dBATCH, -sOutputFile=C:\ProgramData\InBetween\Temp\InBetweenClient\IBTemp\eps_1315788182298900160284840496668bb606f-85b7-4bee-85a9-fa0b2cec6885.png, "D:\Trunkcheckout\IBClientServer\Projects\myview_2356_VerpackungenPNG\Images\piktogramme/eps/2260_Erf_360.eps"] With the square page size given in Comment #2 (-g88x88) this page does not rotate. The logic rotates for best fit when (edx-edy)*(pdx-pdy) is < 0, where the EPS BoundingBox X and Y sizes are edx and edy, respectively, and pdx is the page size in X, and pdy is is the page size in Y. The EPS file has: %%HiResBoundingBox: 0 0 80.5997 80.6001 which means that the size in X (edx in the above) is very slightly less than the Y size (edy), thus (edx-edy) will be negative and if the page size has X size larger than Y size (as with -gg271x38) then (edx-edy) will be positive and the product will be negative. With the square page size (-g88x88) the product will always be 0, so it will not rotate, which is what I observe. Note that prior to commit 826f4411a that fixes Bug 702607, the logic had some problems. Note that in that bug there is a subsequent patch (that is NOT yet accepted) that allows for a flag to disable rotation. You may want to apply that. (In reply to Ray Johnston from comment #2) > With the square page size given in Comment #2 (-g88x88) this page does not > rotate. Did you include -r300 on the command line ? If I do that I can reproduce the problem. yes. i have added that as to render the image at 300dpi hello i tried setting the rotationflag to false, but still no luck. but if i change the size of the image, for instance -g113*113, the image does not rotate, also if i st -r300 to some other value like 72dpi -r72, image does not rotate. it only seems to be rotating for -g88*88 at 300 dpi(-r300) so is there some correlation to dpi and image size, like they rotate at some value thresholds? The problem is that the %%BoundingBox scales (and centers) the image using those values (0 0 81 81) which with -g88x88 sets the CTM to: xx: 1.08641982 xy: 0.000000000 yx: 0.000000000 yy: -1.08641982 tx: -2.38418579e-07 ty: 88.0000000 Then when the %%HiResBoundingBox is processed, the clippath pathbbox returns a slightly non-square page size, which can result in inadvertent rotation. I have a patch to gs_epsf.ps in test that only applies the FitPage scaling, centering and rotation once. Fixed in commit 8313e4f30bef7c50711cd503c3037184a7850d51 Changed to only apply the scaling, centering, and rotation once so we don't encounter the rounding problems that caused the strange behavior depending on the device resolution. |