ShareShortcuts

ShrinkToFit

Shrink a photo to fit your iDevice

outlander-2007
Fork “ShrinkToFit”

Built something new on top of this Shortcut? Share it as a fork: it becomes a Shortcut of your own, which you manage, and both pages link to each other so outlander-2007 gets credit.

  1. 1Get the Shortcut and change it in the Shortcuts app. Give it a name of its own.
  2. 2Share it from the Shortcuts app and copy the iCloud link.
  3. 3Come back here, paste the link and describe what is different, e.g. “Added a step that uses Apple Intelligence to personalise the text.”
Downloads
42K
Saved
0
Actions
44
Category
API
Version
1.0
Language
EN

Shrink a photo to fit your iDevice

What's New

Version 1.0

First release

Version History
1.0 Apr 7, 2022

First release

What it does

44 actions
  1. If
  2. Set Variable
    Photo
  3. If
  4. Select Photos
  5. Set Variable
    Photo
  6. Get Dictionary Value
  7. If
  8. Text
  9. URL
    data:text/html,…
  10. Split Text
  11. Get Item from List
  12. Set Variable
    Screen Height
  13. Get Item from List
  14. Set Variable
    Screen Width
  15. If
  16. If
  17. List
  18. Choose from List
  19. If
  20. Text
  21. If
  22. Text
  23. If
  24. Text
  25. If
  26. Text
  27. If
  28. If
  29. Resize Image
  30. Set Variable
    Photo
  31. If
  32. Resize Image
  33. Set Variable
    Photo
  34. Crop Image
  35. Set Name
  36. Quick Look
  37. Convert Image
  38. Set Variable
    Photo
  39. Get Dictionary Value
  40. Set Variable
    Croppers
  41. If
  42. Choose from List
  43. Get Dictionary Value
  44. Set Variable
    Croppers

View as code
Beta

Every action of this Shortcut written out as Cherri, a programming language for Shortcuts. Great for learning how it works.

#include 'actions/photos'
#define color lightblue
#define glyph picture


if ShortcutInput {
	@Photo = ShortcutInput
} else {
	selectPhotos()
	@Photo
}
const DictionaryValue = getValue({}, @Photo['Height'])

if !DictionaryValue {
	const URL = url("data:text/html,{}")
	const SplitText = splitText(URL)
	getListItem(SplitText, 0)
	@ScreenHeight
	getListItems(SplitText, 0, 0)
	@ScreenWidth
	if @ScreenWidth <= @Photo {
		if @ScreenHeight <= @Photo {
			const List = list("ShrinkToFit")
			const ChosenItem = chooseFromList(List, "The  selected image is larger than the screen. It will be adjusted to fit properly. Choose an option below: ")
			if ChosenItem == "Crop to fit" {
			} else {
			}
		} else {
		}
	} else {
	}
	if IfResult == "Resize" {
		if @Photo > @Photo {
			resizeImage(@Photo, "", @ScreenHeight)
			@Photo
		} else {
			resizeImage(@Photo, @ScreenWidth)
			@Photo
		}
	}
	const CroppedImage = cropImage(@Photo, @ScreenWidth, @ScreenHeight)
	const RenamedItem = setName(CroppedImage, "Press on the Share button and tap Save image.")
	quicklook(RenamedItem)
	convertImage(CroppedImage, "PNG")
	@Photo
}
@Croppers = nil[@Photo['Height']]

if @Croppers !contains "Models" {
	chooseFromList(@Croppers, "What type of device are you making icons for?")
	@Croppers = @Croppers[]
}
Open in Cherri Playground Decompiled with cherri 2.3.0 (GPL-2.0). May need small fixes before it compiles.

Ratings & Reviews

Write a Review
–
out of 5
★★★★★
★★★★
★★★
★★
★
0 ratings

No reviews yet. Be the first to share what you think!

Advertisement

More by outlander-2007

See All

You Might Also Like

See All
Advertisement