使用imagemagick将svg转换为pdf-如何控制输出参数

问题描述

我正在尝试使用convert将svg转换为pdf。

我想使用convert,因为它可以在同一步骤中更改颜色配置文件。我正在使用convert in.svg -profile icc:ISOcoated_v2_eci.icc -colorspace cmyk out.pdf,并使用参数-density-page-units进行修饰。

问题是,如果我只是convert in.svg out.pdf,纸张尺寸是正确的,但是图像的分辨率太低,几乎无法识别。我知道ImageMagick会光栅化图像,并且我需要控制该过程才能获得所需的结果,但是我尝试的每个解决方案都无效。

也:在Google上弹出的许多结果都导致进入了官方论坛,而该论坛似乎无法重定向到google显示主题,这使我留在了主页上。集成搜索也不用。

我的输入svg具有以下属性(identify -verbose的输出):

Image: in.svg
  Format: SVG (scalable Vector Graphics)
  Mime type: image/svg+xml
  Class: DirectClass
  Geometry: 187x187+0+0
  Resolution: 38.17x38.17
  Print size: 4.89914x4.89914
  Units: PixelsPerCentimeter
  Colorspace: sRGB
  Type: GrayscaleAlpha
  Base type: Undefined
  Endianess: Undefined
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
    alpha: 1-bit
  Channel statistics:
    Pixels: 34969
    Red:
      min: 0  (0)
      max: 255 (1)
      mean: 150.228 (0.589128)
      standard deviation: 120.041 (0.470747)
      kurtosis: -1.80957
      skewness: -0.349835
      entropy: 0.331969
    Green:
      min: 0  (0)
      max: 255 (1)
      mean: 150.228 (0.589128)
      standard deviation: 120.041 (0.470747)
      kurtosis: -1.80957
      skewness: -0.349835
      entropy: 0.331969
    Blue:
      min: 0  (0)
      max: 255 (1)
      mean: 150.228 (0.589128)
      standard deviation: 120.041 (0.470747)
      kurtosis: -1.80957
      skewness: -0.349835
      entropy: 0.331969
    Alpha:
      min: 255  (1)
      max: 255 (1)
      mean: 255 (1)
      standard deviation: 2.68694e-06 (1.0537e-08)
      kurtosis: -3
      skewness: 3.03687e+09
      entropy: 4.82164e-05
  Image statistics:
    Overall:
      min: 0  (0)
      max: 255 (1)
      mean: 176.421 (0.691846)
      standard deviation: 90.0304 (0.35306)
      kurtosis: -1.26417
      skewness: -0.819069
      entropy: 0.248989
  Colors: 256
  Histogram:
     10907: (  0,255) #000000FF black
       269: (  1,1,255) #010101FF srgba(1,1)
       161: (  2,2,255) #020202FF srgba(2,1)
        95: (  3,3,255) #030303FF grey1
        85: (  4,4,255) #040404FF srgba(4,1)
        81: (  5,5,255) #050505FF grey2
        75: (  6,6,255) #060606FF srgba(6,1)
        61: (  7,7,255) #070707FF srgba(7,1)
        59: (  8,8,255) #080808FF grey3
        61: (  9,9,255) #090909FF srgba(9,1)
        46: ( 10,10,255) #0A0A0AFF grey4
        55: ( 11,11,255) #0B0B0BFF srgba(11,1)
        42: ( 12,12,255) #0C0C0CFF srgba(12,1)
        58: ( 13,13,255) #0D0D0DFF grey5
        42: ( 14,14,255) #0E0E0EFF srgba(14,1)
        54: ( 15,15,255) #0F0F0FFF grey6
        46: ( 16,16,255) #101010FF srgba(16,1)
        35: ( 17,17,255) #111111FF srgba(17,1)
        34: ( 18,18,255) #121212FF grey7
        35: ( 19,19,255) #131313FF srgba(19,1)
        32: ( 20,20,255) #141414FF grey8
        39: ( 21,21,255) #151515FF srgba(21,1)
        41: ( 22,22,255) #161616FF srgba(22,1)
        38: ( 23,23,255) #171717FF grey9
        49: ( 24,24,255) #181818FF srgba(24,1)
        35: ( 25,25,255) #191919FF srgba(25,1)
        29: ( 26,26,255) #1A1A1AFF grey10
        35: ( 27,27,255) #1B1B1BFF srgba(27,1)
        26: ( 28,28,255) #1C1C1CFF grey11
        32: ( 29,29,255) #1D1D1DFF srgba(29,1)
        29: ( 30,30,255) #1E1E1EFF srgba(30,1)
        32: ( 31,31,255) #1F1F1FFF grey12
        35: ( 32,32,255) #202020FF srgba(32,1)
        18: ( 33,33,255) #212121FF grey13
        28: ( 34,34,255) #222222FF srgba(34,1)
        31: ( 35,35,255) #232323FF srgba(35,1)
        24: ( 36,36,255) #242424FF grey14
        28: ( 37,37,255) #252525FF srgba(37,1)
        34: ( 38,38,255) #262626FF grey15
        30: ( 39,39,255) #272727FF srgba(39,1)
        27: ( 40,40,255) #282828FF srgba(40,1)
        22: ( 41,41,255) #292929FF grey16
        27: ( 42,42,255) #2A2A2AFF srgba(42,1)
        22: ( 43,43,255) #2B2B2BFF grey17
        26: ( 44,44,255) #2C2C2CFF srgba(44,1)
        21: ( 45,45,255) #2D2D2DFF srgba(45,1)
        24: ( 46,46,255) #2E2E2EFF grey18
        34: ( 47,47,255) #2F2F2FFF srgba(47,1)
        22: ( 48,48,255) #303030FF grey19
        23: ( 49,49,255) #313131FF srgba(49,1)
        21: ( 50,50,255) #323232FF srgba(50,1)
        27: ( 51,51,255) #333333FF grey20
        24: ( 52,52,255) #343434FF srgba(52,1)
        25: ( 53,53,255) #353535FF srgba(53,1)
        20: ( 54,54,255) #363636FF grey21
        23: ( 55,55,255) #373737FF srgba(55,1)
        29: ( 56,56,255) #383838FF grey22
        21: ( 57,57,255) #393939FF srgba(57,1)
        21: ( 58,58,255) #3A3A3AFF srgba(58,1)
        18: ( 59,59,255) #3B3B3BFF grey23
        28: ( 60,60,255) #3C3C3CFF srgba(60,1)
        21: ( 61,61,255) #3D3D3DFF grey24
        19: ( 62,62,255) #3E3E3EFF srgba(62,1)
        11: ( 63,63,255) #3F3F3FFF srgba(63,1)
        23: ( 64,64,255) #404040FF grey25
        23: ( 65,65,255) #414141FF srgba(65,1)
        19: ( 66,66,255) #424242FF grey26
        16: ( 67,67,255) #434343FF srgba(67,1)
        15: ( 68,68,255) #444444FF srgba(68,1)
        17: ( 69,69,255) #454545FF grey27
        24: ( 70,70,255) #464646FF srgba(70,1)
        16: ( 71,71,255) #474747FF grey28
         6: ( 72,72,255) #484848FF srgba(72,1)
        19: ( 73,73,255) #494949FF srgba(73,1)
        20: ( 74,74,255) #4A4A4AFF grey29
        19: ( 75,75,255) #4B4B4BFF srgba(75,1)
        19: ( 76,76,255) #4C4C4CFF srgba(76,1)
        25: ( 77,77,255) #4D4D4DFF grey30
        11: ( 78,78,255) #4E4E4EFF srgba(78,1)
        14: ( 79,79,255) #4F4F4FFF grey31
        18: ( 80,80,255) #505050FF srgba(80,1)
        17: ( 81,81,255) #515151FF srgba(81,1)
        22: ( 82,82,255) #525252FF grey32
         9: ( 83,83,255) #535353FF srgba(83,1)
        22: ( 84,84,255) #545454FF grey33
        19: ( 85,85,255) #555555FF srgba(85,1)
        19: ( 86,86,255) #565656FF srgba(86,1)
         9: ( 87,87,255) #575757FF grey34
        21: ( 88,88,255) #585858FF srgba(88,1)
        26: ( 89,89,255) #595959FF grey35
        16: ( 90,90,255) #5A5A5AFF srgba(90,1)
        18: ( 91,91,255) #5B5B5BFF srgba(91,1)
        17: ( 92,92,255) #5C5C5CFF grey36
        15: ( 93,93,255) #5D5D5DFF srgba(93,1)
        10: ( 94,94,255) #5E5E5EFF grey37
        23: ( 95,95,255) #5F5F5FFF srgba(95,1)
        10: ( 96,96,255) #606060FF srgba(96,1)
        15: ( 97,97,255) #616161FF grey38
        17: ( 98,98,255) #626262FF srgba(98,1)
        12: ( 99,99,255) #636363FF grey39
        30: (100,100,255) #646464FF srgba(100,1)
        10: (101,101,255) #656565FF srgba(101,1)
        15: (102,102,255) #666666FF grey40
        12: (103,103,255) #676767FF srgba(103,1)
        22: (104,104,255) #686868FF srgba(104,1)
        18: (105,105,255) #696969FF DimGray
        11: (106,106,255) #6A6A6AFF srgba(106,1)
        18: (107,107,255) #6B6B6BFF grey42
         9: (108,108,255) #6C6C6CFF srgba(108,1)
         9: (109,109,255) #6D6D6DFF srgba(109,1)
        12: (110,110,255) #6E6E6EFF grey43
        22: (111,111,255) #6F6F6FFF srgba(111,1)
        16: (112,112,255) #707070FF grey44
        20: (113,113,255) #717171FF srgba(113,1)
        15: (114,114,255) #727272FF srgba(114,1)
        26: (115,115,255) #737373FF grey45
         6: (116,116,255) #747474FF srgba(116,1)
        14: (117,117,255) #757575FF grey46
        10: (118,118,255) #767676FF srgba(118,1)
        14: (119,119,255) #777777FF srgba(119,1)
        12: (120,120,255) #787878FF grey47
        12: (121,121,255) #797979FF srgba(121,1)
         9: (122,122,255) #7A7A7AFF grey48
        12: (123,123,255) #7B7B7BFF srgba(123,1)
        19: (124,124,255) #7C7C7CFF srgba(124,1)
         9: (125,125,255) #7D7D7DFF grey49
        19: (126,126,255) #7E7E7EFF gray
        10: (127,127,255) #7F7F7FFF grey50
        21: (128,128,255) #808080FF fractal
        12: (129,129,255) #818181FF srgba(129,1)
         9: (130,130,255) #828282FF grey51
        12: (131,131,255) #838383FF srgba(131,1)
        12: (132,132,255) #848484FF srgba(132,1)
        24: (133,133,255) #858585FF grey52
         8: (134,134,255) #868686FF srgba(134,1)
        10: (135,135,255) #878787FF grey53
        15: (136,136,255) #888888FF srgba(136,1)
        10: (137,137,255) #898989FF srgba(137,1)
        13: (138,138,255) #8A8A8AFF grey54
        14: (139,139,255) #8B8B8BFF srgba(139,1)
        13: (140,140,255) #8C8C8CFF grey55
        16: (141,141,255) #8D8D8DFF srgba(141,1)
        23: (142,142,255) #8E8E8EFF srgba(142,1)
        18: (143,143,255) #8F8F8FFF grey56
        20: (144,144,255) #909090FF srgba(144,1)
        15: (145,145,255) #919191FF grey57
        15: (146,146,255) #929292FF srgba(146,1)
        15: (147,147,255) #939393FF srgba(147,1)
        18: (148,148,255) #949494FF grey58
        10: (149,149,255) #959595FF srgba(149,1)
        13: (150,150,255) #969696FF grey59
        14: (151,151,255) #979797FF srgba(151,1)
         8: (152,152,255) #989898FF srgba(152,1)
         9: (153,153,255) #999999FF grey60
        18: (154,154,255) #9A9A9AFF srgba(154,1)
        10: (155,155,255) #9B9B9BFF srgba(155,1)
        15: (156,156,255) #9C9C9CFF grey61
        10: (157,157,255) #9D9D9DFF srgba(157,1)
        21: (158,158,255) #9E9E9EFF grey62
         7: (159,159,255) #9F9F9FFF srgba(159,1)
        14: (160,160,255) #A0A0A0FF srgba(160,1)
        12: (161,161,255) #A1A1A1FF grey63
        20: (162,162,255) #A2A2A2FF srgba(162,1)
         6: (163,163,255) #A3A3A3FF grey64
         8: (164,164,255) #A4A4A4FF srgba(164,1)
        10: (165,165,255) #A5A5A5FF srgba(165,1)
        16: (166,166,255) #A6A6A6FF grey65
         8: (167,167,255) #A7A7A7FF srgba(167,1)
         9: (168,168,255) #A8A8A8FF grey66
        16: (169,169,255) #A9A9A9FF DarkGray
        22: (170,170,255) #AAAAAAFF srgba(170,1)
        12: (171,171,255) #ABABABFF grey67
         8: (172,172,255) #ACACACFF srgba(172,1)
        13: (173,173,255) #ADADADFF grey68
        11: (174,174,255) #AEAEAEFF srgba(174,1)
        11: (175,175,255) #AFAFAFFF srgba(175,1)
         9: (176,176,255) #B0B0B0FF grey69
         4: (177,177,255) #B1B1B1FF srgba(177,1)
         9: (178,178,255) #B2B2B2FF srgba(178,1)
        25: (179,179,255) #B3B3B3FF grey70
        16: (180,180,255) #B4B4B4FF srgba(180,1)
        19: (181,181,255) #B5B5B5FF grey71
         7: (182,182,255) #B6B6B6FF srgba(182,1)
         9: (183,183,255) #B7B7B7FF srgba(183,1)
        17: (184,184,255) #B8B8B8FF grey72
        19: (185,185,255) #B9B9B9FF srgba(185,1)
        10: (186,186,255) #BABABAFF grey73
        18: (187,187,255) #BBBBBBFF srgba(187,1)
        10: (188,188,255) #BCBCBCFF srgba(188,1)
        10: (189,189,255) #BDBDBDFF grey74
        12: (190,190,255) #BEBEBEFF grey
        24: (191,191,255) #BFBFBFFF grey75
        15: (192,192,255) #C0C0C0FF silver
         7: (193,193,255) #C1C1C1FF srgba(193,1)
         6: (194,194,255) #C2C2C2FF grey76
         9: (195,195,255) #C3C3C3FF srgba(195,1)
         8: (196,196,255) #C4C4C4FF grey77
         9: (197,197,255) #C5C5C5FF srgba(197,1)
        18: (198,198,255) #C6C6C6FF srgba(198,1)
        14: (199,199,255) #C7C7C7FF grey78
        10: (200,200,255) #C8C8C8FF srgba(200,1)
        11: (201,201,255) #C9C9C9FF grey79
        11: (202,202,255) #CACACAFF srgba(202,1)
        11: (203,203,255) #CBCBCBFF srgba(203,1)
        15: (204,204,255) #CCCCCCFF grey80
        11: (205,205,255) #CDCDCDFF srgba(205,1)
        19: (206,206,255) #CECECEFF srgba(206,1)
        18: (207,207,255) #CFCFCFFF grey81
        10: (208,208,255) #D0D0D0FF srgba(208,1)
        11: (209,209,255) #D1D1D1FF grey82
        16: (210,210,255) #D2D2D2FF srgba(210,1)
         7: (211,211,255) #D3D3D3FF LightGray
        15: (212,212,255) #D4D4D4FF grey83
         8: (213,213,255) #D5D5D5FF srgba(213,1)
        11: (214,214,255) #D6D6D6FF grey84
        10: (215,215,255) #D7D7D7FF srgba(215,1)
        15: (216,216,255) #D8D8D8FF srgba(216,1)
        22: (217,217,255) #D9D9D9FF grey85
        17: (218,218,255) #DADADAFF srgba(218,1)
        17: (219,219,255) #DBDBDBFF grey86
        14: (220,220,255) #DCDCDCFF gainsboro
        11: (221,221,255) #ddddDDFF srgba(221,1)
        15: (222,222,255) #DEDEDEFF grey87
        14: (223,223,255) #DFDFDFFF srgba(223,1)
        17: (224,224,255) #E0E0E0FF grey88
        16: (225,225,255) #E1E1E1FF srgba(225,1)
        15: (226,226,255) #E2E2E2FF srgba(226,1)
        22: (227,227,255) #E3E3E3FF grey89
        21: (228,228,255) #E4E4E4FF srgba(228,1)
        14: (229,229,255) #E5E5E5FF grey90
        16: (230,230,255) #E6E6E6FF srgba(230,1)
        13: (231,231,255) #E7E7E7FF srgba(231,1)
        22: (232,232,255) #E8E8E8FF grey91
        27: (233,233,255) #E9E9E9FF srgba(233,1)
        21: (234,234,255) #EAEAEAFF srgba(234,1)
        12: (235,235,255) #EBEBEBFF grey92
        11: (236,236,255) #ECECECFF srgba(236,1)
        11: (237,237,255) #EDEDEDFF grey93
        15: (238,238,255) #EEEEEEFF srgba(238,1)
        20: (239,239,255) #EFEFEFFF srgba(239,1)
        12: (240,240,255) #F0F0F0FF grey94
        23: (241,241,255) #F1F1F1FF srgba(241,1)
        17: (242,242,255) #F2F2F2FF grey95
        27: (243,243,255) #F3F3F3FF srgba(243,1)
        27: (244,244,255) #F4F4F4FF srgba(244,1)
        18: (245,245,255) #F5F5F5FF grey96
        25: (246,246,255) #F6F6F6FF srgba(246,1)
        28: (247,247,255) #F7F7F7FF grey97
        25: (248,248,255) #F8F8F8FF srgba(248,1)
        26: (249,249,255) #F9F9F9FF srgba(249,1)
        29: (250,250,255) #FAFAFAFF grey98
        40: (251,251,255) #FBFBFBFF srgba(251,1)
        49: (252,252,255) #FCFCFCFF grey99
        53: (253,253,255) #FDFDFDFF srgba(253,1)
        50: (254,254,255) #FEFEFEFF srgba(254,1)
     18446: (255,255,255) #FFFFFFFF white
  Rendering intent: Perceptual
  Gamma: 0.454545
  chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Background color: white
  Border color: srgba(223,1)
  Matte color: grey74
  Transparent color: none
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 187x187+0+0
  dispose: Undefined
  Iterations: 0
  Compression: Zip
  Orientation: Undefined
  Properties:
    date:create: 2020-10-02T18:24:53+02:00
    date:modify: 2020-10-02T18:24:53+02:00
    png:IHDR.bit-depth-orig: 8
    png:IHDR.bit_depth: 8
    png:IHDR.color-type-orig: 6
    png:IHDR.color_type: 6 (RGBA)
    png:IHDR.interlace_method: 0 (Not interlaced)
    png:IHDR.width,height: 187,187
    png:pHYs: x_res=3817,y_res=3817,units=1
    png:sRGB: intent=0 (Perceptual Intent)
    png:text: 1 tEXt/zTXt/iTXt chunks were found
    signature: ef3b620cdef69e04828923541137337a25f70a86c32c6a11e0271aab59e8a1b2
    Software: www.inkscape.org
  Artifacts:
    filename: in.svg
    verbose: true
  Tainted: False
  Filesize: 21952B
  Number pixels: 34969
  User time: 0.000u
  Elapsed time: 0:01.000
  Version: ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)