Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

gs_check.sh 3.0 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
  1. #!/usr/bin/env bash
  2. #
  3. # Create original PS plot and PNG image that include these GMT features:
  4. # a) patterns
  5. # b) image
  6. # c) transparency
  7. # d) lines and annotations, including degree symbol
  8. #
  9. # Then run the new candidate gs with suitable options to create a PNG we can compare
  10. # using gmt compare to the original PNG that we have verified manually.
  11. # Run from the top gmt-dev directory
  12. if [ ! -d cmake ]; then
  13. echo "Must be run from top-level gmt directory"
  14. exit 1
  15. fi
  16. if [ ! -d build ]; then
  17. mkdir -p build
  18. fi
  19. # Do the work in the build directory
  20. echo "Working in build directory"
  21. cd build
  22. if [ ! -f ../admin/PS_orig_for_gs.ps ]; then
  23. # Make the original GMT PS plot if it is not present
  24. gmt begin PS_orig_for_gs ps
  25. gmt set PS_MEDIA letter
  26. gmt grdimage -R0/20/0/20 -JM16c @earth_relief_05m -B -B+t"GMT TEST PLOT" -I+d
  27. echo 10 10 | gmt plot -Ss6c -Gp20+r100+fblue -W2p
  28. echo 4 4 | gmt plot -Ss6c -Gwhite@50 -W2p
  29. echo 16 16 | gmt plot -Ss6c -Gwhite -W2p
  30. gmt end
  31. # Place the original PS in admin
  32. mv PS_orig_for_gs.ps ../admin
  33. echo "Add admin/PS_orig_for_gs.ps to GitHub as the basis for comparisons"
  34. fi
  35. if [ ! -f ../admin/PS_orig_for_gs.png ]; then
  36. # Create the original PNG with transparency via PDF if it is not present
  37. gmt psconvert ../admin/PS_orig_for_gs.ps -TG
  38. rm -f ../admin/PS_orig_for_gs_intermediate.pdf
  39. echo "Add admin/PS_orig_for_gs.png to GitHub as the basis for comparisons"
  40. fi
  41. # Test if current gs version can reproduce our original
  42. echo "Convert PS_orig_for_gs.ps to PS_orig_for_gs.pdf in order to achieve transparency"
  43. gs -q -dNOPAUSE -dBATCH -dNOSAFER -dPDFSETTINGS=/prepress -dDownsampleColorImages=false -dDownsampleGrayImages=false \
  44. -dDownsampleMonoImages=false -dUseFlateCompression=true -dEmbedAllFonts=true -dSubsetFonts=true -dMonoImageFilter=/FlateEncode \
  45. -dAutoFilterGrayImages=false -dGrayImageFilter=/FlateEncode -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode \
  46. -dSCANCONVERTERTYPE=2 -dALLOWPSTRANSPARENCY -dMaxBitmap=2147483647 -dUseFastColor=true -dGraphicsAlphaBits=1 -dTextAlphaBits=1 \
  47. -sDEVICE=pdfwrite -g2550x3300 -r300 -sOutputFile='PS_orig_for_gs_intermediate.pdf' '../admin/PS_orig_for_gs.ps'
  48. echo "Convert PS_orig_for_gs.pdf to PS_orig_for_gs.png"
  49. gs -q -dNOPAUSE -dBATCH -dNOSAFER -dPDFSETTINGS=/prepress -dDownsampleColorImages=false -dDownsampleGrayImages=false \
  50. -dDownsampleMonoImages=false -dUseFlateCompression=true -dEmbedAllFonts=true -dSubsetFonts=true -dMonoImageFilter=/FlateEncode \
  51. -dAutoFilterGrayImages=false -dGrayImageFilter=/FlateEncode -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode \
  52. -dSCANCONVERTERTYPE=2 -dALLOWPSTRANSPARENCY -dMaxBitmap=2147483647 -dUseFastColor=true -dGraphicsAlphaBits=2 -dTextAlphaBits=4 \
  53. -sDEVICE=pngalpha -g2550x3300 -r300 -sOutputFile='PS_orig_for_gs.png' 'PS_orig_for_gs_intermediate.pdf'
  54. echo "Compare PS_orig_for_gs.png to ../admin/PS_orig_for_gs.png"
  55. gm compare -density 200 -maximum-error 0.003 -highlight-color magenta -highlight-style assign -metric rmse -file diff.png ../admin/PS_orig_for_gs.png PS_orig_for_gs.png
  56. cd ..
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...