Hi,
I'm trying to read an uncompressed Tif, rotate it around a point that isn't the center of the image, crop it and write (ideally) to the same format, or at very least the same DPI. Rough code below.
I can get it to rotate and crop but on writing out the tif it results in a compressed format that messes with the next part of my script.
When I switched it to exporting a bmp or uncompressed png it seems ok, but the dpi is a 10th of the input and the dimensions are 10 times the size of the original image.
Initial image: 7.23inches, 9.15inches, 1200DPI Output image: 76.38inches 97.3inches 111DPI
This creates a huge image that also screws up the next part of my script.
What do I do? I'm neither a python or OpenCv2 guru, so any help is appreciated with cv2 or if you have an alternative that also works. :) Happy Independence Day.
Cheers, Michael
image = cv2.imread(Path + str(inputline[0]) + ".tif")
Use cv2.warpaffine to rotate
Crop by taking image[y's, x's]
cv2.imwrite(Path + inputline[0] + ".tif", crop_img)