Compress image without losing quality in Node JS

Поделиться
HTML-код
  • Опубликовано: 11 ноя 2024

Комментарии • 25

  • @SathyaPrakashMoparthi
    @SathyaPrakashMoparthi 2 года назад +2

    Thanks for this. I was looking exactly for this 👍🏼

  • @anusrim9840
    @anusrim9840 Год назад +1

    Thanks for the video, how do i mention the size of the compressed image. suppose i want it to rescue to 2MB, how do I mention that?

    • @AdnanAfzal565
      @AdnanAfzal565  Год назад

      There is no such option. Only quality parameter can be used.

  • @entertainmentduniya349
    @entertainmentduniya349 Месяц назад

    If you have already make then plz send the link

  • @entertainmentduniya349
    @entertainmentduniya349 Месяц назад

    Bro can you make a video on image compressor using html,css,react and node js

    • @AdnanAfzal565
      @AdnanAfzal565  Месяц назад

      For that you also need to provide the design too.

  • @GabrielMartinez-ez9ue
    @GabrielMartinez-ez9ue 2 года назад

    Thank you. Is there a way to select multiple images?

    • @AdnanAfzal565
      @AdnanAfzal565  2 года назад +2

      Yes. You can follow this:
      ruclips.net/video/eHEDJBk3ie0/видео.html
      Only follow the bootstrap fd part. Rest will be in Node JS.

    • @GabrielMartinez-ez9ue
      @GabrielMartinez-ez9ue 2 года назад

      @@AdnanAfzal565 thank you very much

    • @AdnanAfzal565
      @AdnanAfzal565  2 года назад

      @@GabrielMartinez-ez9ue You are welcome.

    • @adityasrivastava4421
      @adityasrivastava4421 2 года назад

      @@GabrielMartinez-ez9ue Can you please share the code for Multiple Images ??

    • @adityasrivastava4421
      @adityasrivastava4421 2 года назад

      @@AdnanAfzal565 Can you please share the code for Multiple Images ??

  • @mohammadamaan9410
    @mohammadamaan9410 Год назад

    not installing the pngquant-bin and rest

    • @AdnanAfzal565
      @AdnanAfzal565  Год назад

      Are you using latest node js version ?

    • @mohammadamaan9410
      @mohammadamaan9410 Год назад

      @@AdnanAfzal565 yess

    • @mohammadamaan9410
      @mohammadamaan9410 Год назад

      @@AdnanAfzal565 but i tried to follow the solution and downgrade my version but still getting the problem

    • @AdnanAfzal565
      @AdnanAfzal565  Год назад

      What error are you having ?

    • @mohammadamaan9410
      @mohammadamaan9410 Год назад

      @@AdnanAfzal565 please share your LinkedIn or contact number.

  • @mehemmednezerli38
    @mehemmednezerli38 Год назад

    hi friend, I need your help. this my current code right here and I don't exactly know how to implement your code that is in the video. If it is possible can you say me what to change in this code to compress images like you said?
    thanks in advance man :)
    .
    .
    const photosMiddleware = multer({dest:'uploads/'});
    app.post('/upload', photosMiddleware.array('photos', 100) ,(req,res)=>{
    const uploadedFiles = [];
    for(let i = 0; i < req.files.length;i++){
    const {path, originalname} = req.files[i];
    const parts = originalname.split('.');
    const ext = parts[parts.length-1];
    const newPath = path + '.' + ext;
    fs.renameSync(path, newPath);
    uploadedFiles.push(newPath.replace('uploads\\', ''));
    }
    res.json(uploadedFiles);
    });

    • @AdnanAfzal565
      @AdnanAfzal565  Год назад +2

      Can you kindly tell what error are you having ?

    • @mehemmednezerli38
      @mehemmednezerli38 Год назад

      @@AdnanAfzal565 first of all, thank you for responding man. Actually, I don't get any problem in this code, however I did not get what I have to modify in order to compress image size. If you dont mind I wanna explain what is this code all about.
      So, I use multer and I have folder where all images that uploaded by user stands "uploads/", then I have an array where users can upload multiple images at once, then I change their name and give them new path which is newPath, then I upload to the newPath.replace('uploads\\', ''). this is all about man however I dont exactly know where i have to implement your code that you showed us. if it is possible can you make changes in my code to also compress images. And also thanks for response man:)

    • @mehemmednezerli38
      @mehemmednezerli38 Год назад

      @@AdnanAfzal565 I really need ur help man :-(