How to install ImageMagick?

Here is my replit.nix that does not work

{ pkgs }: {
  deps = [
    pkgs.python310Full
    pkgs.replitPackages.prybar-python310
    pkgs.replitPackages.stderred
    pkgs.ffmpeg-full
    pkgs.imagemagick
  ];
  env = {
    PYTHON_LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
      # Needed for pandas / numpy
      pkgs.stdenv.cc.cc.lib
      pkgs.zlib
      # Needed for pygame
      pkgs.glib
      # Needed for matplotlib
      pkgs.xorg.libX11
    ];
    PYTHONHOME = "${pkgs.python310Full}";
    PYTHONBIN = "${pkgs.python310Full}/bin/python3.10";
    LANG = "en_US.UTF-8";
    STDERREDBIN = "${pkgs.replitPackages.stderred}/bin/stderred";
    PRYBAR_PYTHON_BIN = "${pkgs.replitPackages.prybar-python310}/bin/prybar-python310";
  };
}

Are you sure that is the right name? What errors did nix give?

1 Like

Nix gave no errors, but MoviePy did
Here is my code:

from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip
from moviepy.editor import *
from vars import sound_files, comments
ffmpeg_extract_subclip("MC.mp4", 10, 70, targetname="cut.mp4")

clip = VideoFileClip("cut.mp4")
clips = [clip]
# Generate a text clip 
txt_clip = TextClip("GeeksforGeeks", fontsize = 75, color = 'black').set_pos('center').set_duration(10)
clips.append(txt_clip)
txt_clip0 = TextClip("test", fontsize = 75, color = 'black').set_pos('center').set_duration(10)
clips.append(txt_clip0)
    
# Overlay the text clip on the first video clip 
video = CompositeVideoClip(clips)

video.write_videofile("edit.mp4")

1 Like

it says it is not installed but when I write magick --help it works

2 Likes

I believe the right command is imagemagick.

You can install it on Nix here.

To add a nix package to your Repl, see this guide

2 Likes

What says it is not installed? Nix usually only installs the cli tool, so you need to configure it specially to use it in code, but you can usually just use it normally on the command line.