-1

I am trying to create a car skin for rFactor 2. In GIMP, there is a wireframe of the car that I can see, and this wireframe is a top-down and squished/flattened view (kind of like a map you see of the world). Here's a YT video that shows some of the skin editing steps, although photoshop:

https://youtu.be/YVkm9nQ7QE8

When trying to place decals onto this car design, ideally you want to put stickers in the same position on the "left" and "right" sides of the car. It's easy enough to place guidelines onto the image to define the center of the vehicle, but:

  1. I'm not entirely sure how to determine the position of a selection/content that I copy into the image (a logo). I can see the layer attributes and they give me an X and Y offset, but that doesn't appear to be the center of the thing. In other words, if a layer is not the entire image, how can I determine its center point?

  2. I suppose I can do the math on my own to figure out where different parts of the wire are, or I can use the measure tool. But given that the layer attributes X/Y offset are not apparently to the center of the layer, what's the best way to relocate the copied/duplicated layer to the same distance from the centerline?

Hopefully, this makes some sense. If it doesn't, I'll try to upload an image to go along with the post.

Erik Jacobs
  • 841
  • 3
  • 7
  • 19

1 Answers1

0

The position of the center of a layer is the offset (position of the top right corner) + half the size of each dimension. In Python:

xTopLeft,yTopLeft=layer.offsets
xCenter=xTopLeft+layer.width/2
yCenter=yTopLeft+layer.height/2

And of course, layer.set_offsets(x,y) takes the position of the top right corner. But unless you rotate the layer, the displacement of the top left corner is the same as the one you would compute for the center. So with some luck, you won't even have to wonder about odd/even sizes.

Mind that in a car, decals aren't really mirror images between left and right, since the decals on the left size read front-to-back and those of the right size are read back-to-front.

xenoid
  • 8,396
  • 3
  • 23
  • 49