3

I'm updating an existing macOS app with new images.

One of them is a vector image in PDF format. When I add the PDF to an image set, Xcode determined a size for it:

Image Size

The existing dialog has a larger image, so this new one renders smaller. However, I should be able to scale it to whatever size I like as it's a vector image.

It seems the size comes from metadata in the PDF file. The Inspector in Preview shows:

Inspector, size in points Inspector, size in inches

Are there tools I can use to tweak those values? I don't want to resample the PDF or use tools like ImageMagick - as I said, this is a vector image.

craig65535
  • 3,439
  • 1
  • 23
  • 49
  • Since it's a vector image, and is going to be displayed as a vector image, what do you care what "size" is claimed for it? It will be redrawn scaled at any size you like. – matt May 13 '21 at 07:11
  • No, it's drawn at 60x62 (120x124 on Retina displays). Where is Xcode getting 60x62 from? – craig65535 May 13 '21 at 15:34
  • "should be able to scale it to whatever size I like as it's a vector image" Yes. Resizing is up to you, though; it doesn't happen by magic. See for example https://stackoverflow.com/a/45623000/341994, https://stackoverflow.com/a/62700527/341994 – matt May 13 '21 at 19:14
  • But, to restate the original question, why is Xcode picking 60x62, and can I change it? – craig65535 May 13 '21 at 19:28
  • 1
    Well a PDF does have a "size". Open it in Preview and use the Inspector and you'll see. – matt May 13 '21 at 20:53
  • @matt Thanks for the tip - I can see the size in the Inspector. – craig65535 May 13 '21 at 22:41
  • So can we call this settled? If so, please delete the question so it doesn't hang open. You now know that the size is a real size, but the image can be shown, without rasterization, at _any_ size, because it is a vector image. – matt May 14 '21 at 00:13
  • I changed the question - I know where the size comes from, but I still want a simple way to change it within the PDF file. – craig65535 May 14 '21 at 05:11
  • But why? You can make it draw in your app at any size. Why worry about some dumb numbers in the interface? – matt May 14 '21 at 05:20
  • 1
    I just ran into this same issue. The problem is that the vector image is converted to raster at build-time. This conversion uses the size stored in the PDF. So if the size is smaller than what you need, the result will look pixelated. If it's larger then it bloats your bundle. – Gil Birman Aug 04 '22 at 20:14

0 Answers0