Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
put an image into 3 parts
#4
If you need to rotate an image and compose an another image from its rotated copies, you can use
numpy. If you have scikit-image installed, you can try the following:

from skimage import data
from matplotlib import pyplot as plt
im = data.astronaut()
m, n, c = im.shape
new_im = np.zeros((m*2, n*3, c))
new_im[:m, :n, ...] = im
new_im[:m, 2*n:, ...] = np.rot90(im)
new_im[m:, n:2*n, ...] = np.flipud(im)
new_im = new_im.astype(np.uint8)
plt.imshow(new_im)
You can consequently apply np.rot90 to get desired rotation of the image.
Reply


Messages In This Thread
put an image into 3 parts - by Nickd12 - Sep-28-2020, 07:28 AM
RE: put an image into 3 parts - by Larz60+ - Sep-28-2020, 09:48 AM
RE: put an image into 3 parts - by Nickd12 - Sep-29-2020, 09:26 AM
RE: put an image into 3 parts - by scidam - Sep-29-2020, 10:07 AM
RE: put an image into 3 parts - by Nickd12 - Sep-30-2020, 11:00 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020