Skip to content

Commit

Permalink
♻️ rename image utility class to better fit existing syntax (#265)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianMindee authored Oct 3, 2024
1 parent 7c4b25e commit eb07457
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Mindee/Extraction/ImageExtractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static List<SKBitmap> PdfToImages(byte[] fileBytes)
var width = pageReader.GetPageWidth();
var height = pageReader.GetPageHeight();
var bytes = pageReader.GetImage();
var bmp = MindeeImageUtils.ArrayToImage(MindeeImageUtils.ConvertTo3DArray(bytes, width, height));
var bmp = ImageUtils.ArrayToImage(ImageUtils.ConvertTo3DArray(bytes, width, height));
images.Add(bmp);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Mindee/Image/ImageCompressor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static byte[] CompressImage(byte[] imageData, int quality = 85, int? maxW
int? maxHeight = null)
{
using var original = SKBitmap.Decode(imageData);
var (newWidth, newHeight) = MindeeImageUtils.CalculateNewDimensions(original, maxWidth, maxHeight);
var (newWidth, newHeight) = ImageUtils.CalculateNewDimensions(original, maxWidth, maxHeight);

return CompressImage(original, quality, newWidth, newHeight);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Mindee.Image
/// <summary>
/// Utility class.
/// </summary>
public static class MindeeImageUtils
public static class ImageUtils
{
/// <summary>
/// Converts a raw sequence of bytes representing an image into a 3D pixel array.
Expand Down
4 changes: 2 additions & 2 deletions src/Mindee/Pdf/PdfCompressor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private static SKBitmap GeneratePageBitmap(int imageQuality, IPageReader pageRea
{
var rawBytes = pageReader.GetImage();
var initialBitmap =
MindeeImageUtils.ArrayToImage(MindeeImageUtils.ConvertTo3DArray(rawBytes, width, height));
ImageUtils.ArrayToImage(ImageUtils.ConvertTo3DArray(rawBytes, width, height));

var compressedImage = ImageCompressor.CompressImage(initialBitmap, imageQuality, width, height);

Expand Down Expand Up @@ -140,7 +140,7 @@ private static SKBitmap GeneratePageBitmap(int imageQuality, IPageReader pageRea
private static void WriteTextToCanvas(SKBitmap bitmap, Character character, SKCanvas canvas)
{
using var paint = new SKPaint();
SKColor textColor = MindeeImageUtils.InferTextColor(bitmap, character.Box);
SKColor textColor = ImageUtils.InferTextColor(bitmap, character.Box);
paint.TextSize = (float)character.FontSize * (72f / 96f);
paint.Color = textColor;

Expand Down

0 comments on commit eb07457

Please sign in to comment.