File: shrinkpix/examples/client-usage-cheatsheets-notes.txt

The short story: terse cheat sheets (py3=python3, $W/$C are web/code roots)

gadgets - without backup collections

    To shrink all images in gadgets:
        # originals show up in gadgets/_shrinkpix-originals
        $W/Programs/Current$ py3 $C/shrinkpix/shrinkpix.py gadgets    # -listonly preview, -toplevel optional

    To shrink newly added images:
        $W/Programs/Current$ py3 $C/shrinkpix/shrinkpix.py gadgets -listonly         # find shrinkees
        $W/Programs/Current$ py3 $C/shrinkpix/shrinkpix.py gadgets/newexample.jpg    # or entire folder

    To restore originals:
        $W/Programs/Current$ py3 $C/shrinkpix/restore-unshrunk-images.py gadgets

android-tkinter - with backup collections to a separate folder

    To shrink all images in android-tkinter/android-tkinter:
        # originals show up in android-tkinter/_private_/_shrinkpix-all-originals
        $C/android-tkinter$ py3 $C/shrinkpix/shrinkpix.py android-tkinter
        $C/android-tkinter$ py3 $C/shrinkpix/collect-unshrunk-images.py android-tkinter _private_

    To shrink newly added images:
        $C/android-tkinter$ py3 $C/shrinkpix/shrinkpix.py android-tkinter -listonly              # find shrinkees
        $C/android-tkinter$ py3 $C/shrinkpix/shrinkpix.py android-tkinter/folder/newimage.jpg    # or entire folder
        $C/android-tkinter$ py3 $C/shrinkpix/collect-unshrunk-images.py android-tkinter _private_

    To restore originals:
        $C/android-tkinter$ py3 $C/shrinkpix/restore-unshrunk-images.py _private_/_shrinkpix-all-originals
        $C/android-tkinter$ rsync -avh _private_/_shrinkpix-all-originals/ android-tkinter/
        $C/android-tkinter$ mv -f _private_/_shrinkpix-all-originals ~/Desktop/_shrinkpix-all-originals--PRIOR

==========================================================================================

trnpix's detailed cheat sheet - using shrinkpix when no collection folder is required

To process all large images in the entire trnpix/ folder for online use:
    To shrink large images:
        $W/Posts/Current$ py3 $C/shrinkpix/shrinkpix.py trnpix   [-listonly]?

    To restore all originals, if required (e.g., for a new shrinkpix):
        $W/Posts/Current$ py3 $C/shrinkpix/restore-unshrunk-images.py trnpix   [-listonly]?
        --And reshrink all per above

    # Originals appear as a flat list in trnpix/_shinkpix-originals/, not user visible
    # Retain this folder, uncollected: not included in gallery, and a minor upload hit

After new additions:
    To find oversize images:
        $W/Posts/Current$ py3 $C/shrinkpix/shrinkpix.py trnpix -listonly

    Individually shrink any new images added:
        $W/Posts/Current$ py3 $C/shrinkpix/shrinkpix.py trnpix/newexample.jpg
    Or shrink all in the folder at once:
        $W/Posts/Current$ py3 $C/shrinkpix/shrinkpix.py trnpix

    # New originals will be saved in the existing backup folder, trnpix/_shinkpix_originals/

And rebuild the thumbspage gallery for new image info, per _HOW.txt.

==========================================================================================

thumbspage's detailed cheat sheet - using shrinkpix on a tree with a separate collection folder

To process all large images in the entire thumbspage/examples/ tree for online use:
    To shrink large images:
        $C/thumbspage$ py3 $C/shrinkpix/shrinkpix.py examples   [-listonly]?
        $C/thumbspage$ py3 $C/shrinkpix/collect-unshrunk-images.py examples _private   [-listonly?]

    To restore all originals, if required (e.g., for a new shrinkpix):
        $C/thumbspage$ py3 $C/shrinkpix/restore-unshrunk-images.py _private/_shrinkpix-all-originals
        $C/thumbspage$ rsync -avh _private/_shrinkpix-all-originals/ examples/
        $C/thumbspage$ mv -f _private/_shrinkpix-all-originals ~/Desktop/_shrinkpix-all-originals--PRIOR
        --And reshrink and recollect all per above

    # Originals appear at root-relative paths in thumbspage/_private/_shinkpix_all_originals/, not shipped
    # The first set runs shrinkpix and then its collector on examples/, moving backups to _private/
    # The second set uses restore to collapse the collection tree, and rsyncs it back into examples/
    # No longer used: $ mv examples/_shrinkpix-all-originals/ _private/ (use collector arg instead)

After new additions:
    To find new large images:
        $C/thumbspage$ py3 $C/shrinkpix/shrinkpix.py examples -listonly
 
    Individually shrink any new images added:
        $C/thumbspage$ py3 $C/shrinkpix/shrinkpix.py examples/somefolder/newimage.jpg
    Or shrink all in a folder at once:
        $C/thumbspage$ py3 $C/shrinkpix/shrinkpix.py examples/somefolder

    Then move saved-original backups to the collection tree:
        $C/thumbspage$ py3 $C/shrinkpix/collect-unshrunk-images.py examples _private

    # New originals are saved at rel paths in existing thumbspage/_private/_shinkpix_all_originals 
    # Normally large: thumbspage/examples/mixedtypes/space-monkey.gif [599070 bytes, not changed]

And rebuild all thumbspage galleries for new image info, per the examples' _HOW-MADE.txt files.

==========================================================================================

A thumbspage build note on combining shrinkpix and thumbspage image rotation

UPDATE March 2020: Using shrinkpix on folders with rotated images

For all rotated images here, the existing gallery versions did not 
have the 1.7 fix for Exif-tag propagation and updates.  Applying this
fix required a 4-step process: unrotated originals (with full tags) 
were restored with the restore*.py here; thumbspage was run to rotate
the originals (and propagate their tags); the shrinkpix program was 
used to reduce the sizes of rotated originals; and then thumbspage 
was run again to pick up the new shrunken image information.  The 
shrinkpix saved (and already rotated) originals here were propagated 
to _private, so future restores won't undo rotations and tags.

Convoluted, yes, but date-taken now shows up for rotated images as it 
should, and most of this isn't required for new galleries (these were 
legacy rotated images).  New galleries with rotated images can either:

1) Rotate originals with thumbspage, shrink, and re-thumbspage for new info
2) Shrink originals, and then run thumbspage to rotate and pick up info

The latter, shrinking before rotating, avoids a step, but some rotations 
wound up slightly above the shrinkpix size cutoff when this was tried,
and you'll need to rerotate with another thumbspage run if saved originals
are ever restored from shrinkpix backups (a rerun is probably needed anyhow).



[Home page] Books Code Blog Python Author Train Find ©M.Lutz