Automatically adding transparency and removing whitespace from images

Sdílet
Vložit
  • čas přidán 5. 01. 2019
  • OFFICIAL WEBSITE: lukesmith.xyz 🌐❓🔎
    DONATE NOW: lukesmith.xyz/support 💰😎👌💯
  • Věda a technologie

Komentáře • 74

  • @avocado4877
    @avocado4877 Před 5 lety +82

    Very pleasant clickiness to voice ratio.

  • @gery49
    @gery49 Před 5 lety +64

    Not sure if this can be done in a single line, but I think you could execute transparent with a range of percentages (like {5..95..10}) and pipe that into sxiw to select the one that works best.

    • @LukeSmithxyz
      @LukeSmithxyz  Před 5 lety +54

      okay, this is epic.

    • @gery49
      @gery49 Před 5 lety +4

      @@LukeSmithxyz If it works. I'm just no sure if you can pipe image data out of convert like this

    • @AnastasisGrammenos
      @AnastasisGrammenos Před 5 lety +3

      You can pass `-` as output file to send it to the standard output and then pipe it

    • @LukeSmithxyz
      @LukeSmithxyz  Před 5 lety +12

      You would want to output them as files in /tmp and then pipe their filenames to sxiv since filenames is what it reads. I don't think a one-liner would be possible (or at least elegant), but this could be done.

    • @gery49
      @gery49 Před 5 lety +5

      @@LukeSmithxyz something like:
      for i in {1..20..2}; do
      convert -transparent white -fuzz $i% $1 /tmp/$i"_"$1
      done
      sxiv -to /tmp/*_$1 | xargs mv -t .
      How could I make them appear ordered by transparency tho... If I use 'seq -w' to generate zero padded variables fuzz cant take the value.

  • @The4Qman
    @The4Qman Před 5 lety +5

    Not sure entirely how I found your channel, maybe it was through spaceinvader ones Unraid channel. But I must say, you have guided me to Arch and have opened the door to another chapter in the hobby I love.
    Thank you

  • @saeedbaig4249
    @saeedbaig4249 Před 3 lety +3

    Note that -transparent only work for PNG. Luckily, you can create a PNG from a JPG easily with `convert image.jpg image.png`

  • @jasperzanjani
    @jasperzanjani Před 5 lety

    I've had to do this a lot, and it was definitely something that drew my attention to imagemagick . Fantastic video!

  • @ne0ne0
    @ne0ne0 Před 3 lety +1

    You're a great teacher. Thanks!

  • @matj12
    @matj12 Před 5 lety +3

    Ideally, the transparency for every pixel should be based on the amount of white the pixel has to solve the problem with edges in antialiased images. This is done with Colors → Color to -transparency- Alpha in GIMP.
    Or, more ideally, store all your logos as vector graphics so you don't have to deal with JPEG artifacts and other image imperfections.

    • @matj12
      @matj12 Před 5 lety +1

      @@DetectiveAndrey I looked for some of the logos he showed and I found most of them in svg format.

  • @kmmmsyr9883
    @kmmmsyr9883 Před rokem

    This is useful for stuff like logos, but it fails when there is white in the object. Let's say you want to remove whitespace from a person's photo. It will remove the whitespace, but it also removes the eyes, since they are white as well.

  • @Echo-te1sf
    @Echo-te1sf Před 5 lety +10

    Actually if you look into the manual of imagemagick, convert command is deprecated.
    convert
    Backwards compatiblity for ImageMagick version 6 "convert". Essentually an alias to a restrictive form of the "magick" command, which should be used instead.

  • @wackydriver
    @wackydriver Před 5 lety +2

    @Luke Smith - there is an option (in bash (zsh probably too)) to show current mode in bash's vi mode

  • @paxplay692
    @paxplay692 Před 5 lety +11

    "I actually use it all the time" - every sponsored video ever...
    :thinking:

    • @LukeSmithxyz
      @LukeSmithxyz  Před 5 lety +25

      Lol yeah I'm secretly on the payroll of a decades-old free software project with a crappy plain html website. 👏

    • @paxplay692
      @paxplay692 Před 5 lety +3

      I knew it!!!!

  • @MsDuketown
    @MsDuketown Před 3 měsíci

    0:58 .png specification or file format. You meant size, ie. 48x48.
    Every webdesigner considers .png, .jpg &
    .ico's. The formats/specs are there for almost 30 years.

  • @nikolaosvakalidis
    @nikolaosvakalidis Před rokem

    I had used convert with sane. There was (or most likely is) a very neat trick in it. It has to with convert internal parameters. I was doing pdf to ps and ps back to pdf. From a bunch of megs the new pdf was suddenly a few kbytes! (I was using sth like 600dpi in sane)

  • @mrkhoi3
    @mrkhoi3 Před 5 lety +2

    Patiently waiting for the vifm video.

  • @veganstoiclinuxwarriormonk8187

    best video ever

  • @JKhalaf
    @JKhalaf Před 3 lety

    Nice! Can you please do a video on how you can re-size a bunch of photos, rename them and place them inside a new folder? For example, I have a bb-king.jpg, I'd like to resize it to 60x60 pixels and move the file to a folder with the name '60px'

  • @nilspin
    @nilspin Před 5 lety +5

    I really liked your video on sed.

  • @pszanetti
    @pszanetti Před 3 lety

    Great Much more easy

  • @oddbob6230
    @oddbob6230 Před 5 lety +3

    If only this could be done with current year websites...

    • @4.0.4
      @4.0.4 Před 4 lety

      Whitespace is good. You don't want a page crammed with info, or it would end up looking like a Chinese site.

  • @101BangTons
    @101BangTons Před rokem

    is there any other software or web base that can automatically remove whitespace like your example? thanks

  • @gnisitricks
    @gnisitricks Před 5 lety

    Niceee =)

  • @wild1729
    @wild1729 Před 5 lety

    Nice vifm!!!!

  • @wolverine9632
    @wolverine9632 Před 3 lety

    0:56 just in case anyone thought he uses them for icons

  • @kaihendry
    @kaihendry Před 5 lety +2

    Learned something ! Also there is www.remove.bg/

  • @tc40390
    @tc40390 Před 5 lety +1

    >waiting for you to make a vifm video

  • @zainthemaynnn
    @zainthemaynnn Před 3 lety

    does this still work??? I've been trying -trim all day and nothing is happening... with multiple images. it's creating a new file but that's it.

  • @soyebravat8903
    @soyebravat8903 Před 2 lety

    Is it possible to print with imagemagick? If so what's the command?

  • @BruceT-rg8bp
    @BruceT-rg8bp Před 2 lety

    wow you are good, thank you. Is a there a way to do it as a batch? For example, I have 50 gif files and I want to make them all transparent png files as the batch. How can I do this? thank you so much

  • @itsr4yd946
    @itsr4yd946 Před 4 lety +2

    1:32 why do you have to use such an unpleasant image for an example?

  • @Simon-xi8tb
    @Simon-xi8tb Před 5 lety +2

    YO! That girlfri...I mean keyboard is too loud!

  • @Morpheus776
    @Morpheus776 Před 5 lety +23

    INSTALL TEMPLE OS

  • @0M9H4X_Neckbeard
    @0M9H4X_Neckbeard Před 5 lety

    Mind you boy, that is the old Word icon: cdn.vox-cdn.com/uploads/chorus_asset/file/13588710/office_icons_HD_00007.png

  • @parthshah1284
    @parthshah1284 Před 4 lety

    How do I increase dpi?

  • @XTheMusicMakerX
    @XTheMusicMakerX Před 5 lety +1

    Any chance to make a video on how you sync your dotfiles to github?

    • @fleefie
      @fleefie Před 5 lety +2

      "sudo pacman -Sy git && man git && sudo rm -rf /bin/*

  • @gogl0l386
    @gogl0l386 Před 5 lety +3

    Making Memes only using Vim and Latex Episode 1

  • @soyebravat8903
    @soyebravat8903 Před 2 lety

    hi luke for some reason magick as a command works for me but not convert i've tried online to see as well but these commands dont work for me. any idea why that could be?

    • @mordokai597
      @mordokai597 Před rokem

      depends on your OS/hardware. if you have modern windows convert is deprecated, use magic or mogrify (can be dangeroous, does in-place edits and if it crashes during an operation it can corrupt the original file) if your using linux on a desktop, convert may or may not be available, depending on distro. If youre running it on a raspberryPi like me, the distro repos ONLY host the older rpi-kernel stable version that uses convert

  • @DOLGOVUSER
    @DOLGOVUSER Před 2 lety +1

    very useful for batch edit! Imagine having maaaaaaaany many images to edit, export one by one.
    Thanks, Luke!

    • @mordokai597
      @mordokai597 Před rokem

      if you know anything about writing simple bash scripts, i use this on a tiny raspberryPi to batch-process (up to 1000 at a time) AI generated art that needs to be sorted by modify-date (oldest>newest) upscaled, antialiased, median blurred, sharpened, then moved to the "Finished" folder and delete the original after completion:
      #!/bin/bash
      cd /home/pi/Projects/IMG/
      for i in {1..1000}
      do cd /home/pi/Projects/IMG/Holding/
      n=`ls *.png --sort=time -r | head -n 1`
      cd /home/pi/Projects/IMG/
      convert ./Holding/"${n}" -adaptive-resize 200% -antialias -blur 2x0.5 -adaptive-blur 3x0.5 -adaptive-sharpen 3x0.5 -adaptive-blur 3x0.5 -adaptive-sharpen 3x0.5 ./Finished/"${n}"
      rm ./Holding/"${n}"
      done

  • @irfanatoro
    @irfanatoro Před 5 lety

    Nice thumbnail tho

  • @geremachek
    @geremachek Před 5 lety

    vifm lol

  • @Solarplexus0
    @Solarplexus0 Před 5 lety

    Are you ballsy enough to do a transmission tutorial knowing the fbi will break down your door right when you upload?

    • @CoWinkKeyDinkInc
      @CoWinkKeyDinkInc Před 5 lety

      why would they do that when the only thing we use it for is to download Linux distros? 😉

  • @hixann
    @hixann Před 5 lety

    remove.bg

  • @rochr4
    @rochr4 Před 5 lety

    Oh! Just noticed your bash is not in vi mode, wtf? )

    • @LukeSmithxyz
      @LukeSmithxyz  Před 5 lety +2

      It is.

    • @rochr4
      @rochr4 Před 5 lety

      @@LukeSmithxyz yes, thank You. I am just planning to scan some family photo albums which are pretty old and can't be 'dissasembled' and single page is to big to fit a scanner, was thinking about imagemagic to help me sew those scans together as one page will take probably four scans, imagemagic is life.

  • @mordokai597
    @mordokai597 Před rokem

    if you know anything about writing simple bash scripts, i use this on a tiny raspberryPi to batch-process (up to 1000 at a time) AI generated art that needs to be sorted by modify-date (oldest>newest) upscaled, antialiased, median blurred, sharpened, then moved to the "Finished" folder and delete the original after completion:
    #!/bin/bash
    cd /home/pi/Projects/IMG/
    for i in {1..1000}
    do cd /home/pi/Projects/IMG/Holding/
    n=`ls *.png --sort=time -r | head -n 1`
    cd /home/pi/Projects/IMG/
    convert ./Holding/"${n}" -adaptive-resize 200% -antialias -blur 2x0.5 -adaptive-blur 3x0.5 -adaptive-sharpen 3x0.5 -adaptive-blur 3x0.5 -adaptive-sharpen 3x0.5 ./Finished/"${n}"
    rm ./Holding/"${n}"
    done

  • @Clutter.monkey
    @Clutter.monkey Před 5 lety +4

    Too much troll bait. I don’t know where to start.

  • @apost0167
    @apost0167 Před 5 lety +1

    First

    • @1aminepro
      @1aminepro Před 5 lety +14

      We don't do that here

    • @raiden_is_dj
      @raiden_is_dj Před 5 lety +3

      @@1aminepro first

    • @pepega3344
      @pepega3344 Před 5 lety +2

      @@1aminepro you're just salty you weren't first

  • @DrathVader
    @DrathVader Před 5 lety +1

    dude just install photoshop like wtf