Skip to content

Commit

Permalink
rename method to reflect the new image output format
Browse files Browse the repository at this point in the history
  • Loading branch information
rob93c committed Aug 11, 2024
1 parent 25f1c35 commit 428965e
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public static File convert(File inputFile) throws TelegramApiException {
if (image != null) {
boolean isFileSizeCompliant = isFileSizeLowerThan(inputFile, MAX_IMAGE_FILE_SIZE);

return convertToPng(image, mimeType, isFileSizeCompliant);
return convertToWebp(image, mimeType, isFileSizeCompliant);
}
} catch (TelegramApiException e) {
LOGGER.atWarn().setCause(e).log("The file with {} MIME type could not be converted", mimeType);
Expand Down Expand Up @@ -203,15 +203,15 @@ private static boolean isSupportedVideo(String mimeType) {
}

/**
* Given an image file, it converts it to a png file of the proper dimension (max 512 x 512).
* Given an image file, it converts it to a webp file of the proper dimension (max 512 x 512).
*
* @param image the image to convert to png
* @param image the image to convert to webp
* @param mimeType the MIME type of the file
* @param isFileSizeCompliant {@code true} if the file does not exceed Telegram's limit
* @return converted image, {@code null} if no conversion was required
* @throws TelegramApiException if an error occurred processing passed-in image
*/
private static File convertToPng(ImmutableImage image, String mimeType, boolean isFileSizeCompliant) throws TelegramApiException {
private static File convertToWebp(ImmutableImage image, String mimeType, boolean isFileSizeCompliant) throws TelegramApiException {
if (isImageCompliant(image, mimeType) && isFileSizeCompliant) {
LOGGER.atInfo().log("The image doesn't need conversion");

Expand Down

0 comments on commit 428965e

Please sign in to comment.