Skip to content

Commit

Permalink
ADD Not upscaling images
Browse files Browse the repository at this point in the history
  • Loading branch information
fbury-hec committed Mar 7, 2024
1 parent cd84e43 commit 61f78aa
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/imgHandler/resize.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ func ResizeImage(src_path string, dst_path string, width int) (string, error) {
srcImage, err := imaging.Open(src_path, imaging.AutoOrientation(true))
dstImage800 := imaging.Resize(srcImage, width, 0, imaging.Linear)

bnds := srcImage.Bounds()

width_o := bnds.Size().X
if width_o >= width_o {
log.Info("Requested image bigger than original. nor rescaling. oWidth: ", width_o, " new width ", width)
return src_path, nil
}

// Create the file to which the resized image will be written.
out, err := os.Create(dst_path)
if err != nil {
Expand Down

0 comments on commit 61f78aa

Please sign in to comment.