piskel icon indicating copy to clipboard operation
piskel copied to clipboard

Rotate tool?

Open lobisomemgordo opened this issue 9 years ago • 17 comments

Hi, I cant find how I rotate the selection or the layer. There is some rotate tool or isnt implemented yet? If there isn't, do you guys pretend to add this feature? In my opinion rotate tool is great to make animations easier and fast instead of drawing all over again. I started using this program and I am loving it! Can't believe it's free O/

thanks and great work for the developers!

lobisomemgordo avatar Feb 02 '16 15:02 lobisomemgordo

Hi and thanks for the nice feedback.

There is a very basic rotate feature, which rotates the current layer/frame/animation of 90 degrees clockwise or counterclockwise. See the rotate tool in the "Transforms" panel (gif below).

Free rotation is more complicated to implement, but that would be a nice new feature!

rotate-piskel

juliandescottes avatar Feb 02 '16 16:02 juliandescottes

Hi there! I don't think that Free rotation is needed per se, but since the rotation tool makes an even 90 degrees, it only gives 3 options before it goes back to zero. It would help a lot if we had been more options, so if the rotation tool could rotate to just 15 degrees, it would be a great improvement already. This way, people have a wider range options.

Taikamya avatar Feb 25 '16 20:02 Taikamya

It would be nice to have other rotation angles, but it would be extremely hard to implement because when you rotate a pixel image by any other angles than 90, 180, etc., it becomes blurry and not crisp like the usual pixel image.

ghost avatar Jun 10 '16 19:06 ghost

Hi! I think Mouse Rotation would be nice too, you block the image and the option to rotate blocked image pop out on blocked image border, similar like gimp, paintdotnet, photoshop.

Willsm50 avatar Jul 09 '16 18:07 Willsm50

Would anyone know where I could find an open source code that uses the rotation feature that you wish to add? I'd like to learn more about this and perhaps I could try making it, because even if rotating blurs the image slightly, a few minor adjustments with the eraser and draw tool can fix this and save us time in the long run.

Plasmarift avatar Nov 06 '16 20:11 Plasmarift

@Plasmarift , I think the best way I know to accoplish what you describe (with what little experience I have with image manipulation) is to recolor each pixel according to a pixel that "preceeds" it in the rotation.

I'll see if I can explain: If we want to rotate the image by an arbitrary ammount (say 20 degrees) about an arbitrary origin (say the center pixel), then we start going through each pixel one by one and chose a new color by this algorythm:

Convert the pixel's relative position to the origin to polar coordinates. Transform the polar coordinate by the reverse of the given degree of rotation. (so -20 degrees in our example) Convert the new polar coordinate back to absolute coordinates and grab the color from the underlying pixel. Put that color on the original pixel in a copy grid (so we can still get the original color on that spot for another pixel) Repeat this for each pixel on the canvas.

Now, I have no idea how this would be implemented in the piskel app, and I have no idea if it's practical for large animations or previews (it would take no less than 4 trig function calls per pixel as far as I know.)

Hope that helps!

smiegrin avatar Nov 08 '16 00:11 smiegrin

One thing that can be painful here are transparent pixels. Piskel doesn't support colors with an alpha channel due to performance issues.

If you rotate a layer which contains transparent pixels, all the pixels sitting next to transparent pixels would need to become semi transparent after the rotation. Since we can't do that at the moment the end result will be a bit rough.

juliandescottes avatar Nov 08 '16 09:11 juliandescottes

+1

PhPPgAdminBug avatar Apr 04 '18 06:04 PhPPgAdminBug

If someone is interested, the algorithm that Aseprite uses for free rotation is "RotSprite" by Xenowhirl (2007).

Here's the link to the original thread where he talk about with more info on page 2 [1], the link to the website about the algorithm [2] and the "always requested" Wikipedia entry about it [3].

[1] http://forums.sonicretro.org/index.php?showtopic=8848 [2] http://info.sonicretro.org/RotSprite [3] https://en.wikipedia.org/wiki/Pixel-art_scaling_algorithms#RotSprite

Basically, it makes the image 8X bigger, linear rotation, and a 8X reduction, keeping the color palette intact.

franzrogar avatar Feb 21 '19 14:02 franzrogar

How about something that rotates just the selected instead of the whole frame?

Brooksquid avatar Aug 28 '20 20:08 Brooksquid

How about something that rotates just the selected instead of the whole frame?

The best way to incorporate such a function, that I can think of, is if a selection is made and the user holds a certain key while they rotate (like shift, alt/opt, ctrl/cmd). But then there comes the question of whether you are trying to rotate around the center of the frame or around the center of the selection, which gets complicated.

OPStellar avatar Aug 29 '20 18:08 OPStellar

I think the biggest problem would be how the pixels morph to fit the new image when rotated at a degree other than a right angle. If they could implement the pixels to morph so it fits the new rotation, they could simply add a text input that lets you input what rotation angle the sprite should be at. For instance, if I put in 60 for the rotation, it should rotated 60 degrees clockwise. If I input -120 degrees, it should rotate 120 degrees counterclockwise. (Also, if I got the clockwise and counterclockwise mixed up, my mistake)

Kirkinator2000 avatar Nov 20 '24 18:11 Kirkinator2000

very late but a way to rotate selection is open img in new tab, crop to selection, rotate everything, copy and paste

Enzodtz avatar May 15 '25 00:05 Enzodtz

@Enzodtz I'm glad you commented. I was unaware of this thread, but I have an active pull request to add this feature: https://github.com/piskelapp/piskel/pull/1162

My solution is very similar to what @Kirkinator2000 suggested.

This thread feels very similar / a duplicate of https://github.com/piskelapp/piskel/issues/1076

enykwest avatar May 15 '25 01:05 enykwest

i've actually been wondering why there hasn't been much activity relating to Piskel since theres a ton of pull requests that could be merged, like @enykwest 's new rotate tool, that would make it much better to use

Syembol avatar May 29 '25 21:05 Syembol

Hello all, I created this tool a few years ago that helps rotating sprites with ease, I hope you guys find it helpful: https://github.com/adnanlah/rotsprite-webgl.

Thank you.

adnanlah avatar Nov 03 '25 01:11 adnanlah

@Enzodtz I'm glad you commented. I was unaware of this thread, but I have an active pull request to add this feature: #1162

My solution is very similar to what @Kirkinator2000 suggested.

This thread feels very similar / a duplicate of #1076

Tagging yet another Rotate request: #895

enykwest avatar Nov 06 '25 15:11 enykwest