<commit_before>package net.coobird.thumbnailator;

import java.awt.Dimension;
import java.awt.image.BufferedImage;
import java.io.IOException;

import net.coobird.thumbnailator.builders.BufferedImageBuilder;
import net.coobird.thumbnailator.filters.Watermark;
import net.coobird.thumbnailator.resizers.Resizer;
import net.coobird.thumbnailator.resizers.ResizerFactory;
import net.coobird.thumbnailator.tasks.ThumbnailTask;

/**
 * This class provides utilities methods to exectute {@link ThumbnailTask}s.
 * 
 * @author coobird
 *
 */
public class Thumbnailator
{
	/**
	 * This class is not intended to be instantiated.
	 */
	private Thumbnailator() {}
	
	/**
	 * Creates a thumbnail from parameters specified in a {@link ThumbnailTask}.
	 * 
	 * @param task				A {@link ThumbnailTask} to execute.
	 * @throws IOException		Thrown when a problem occurs when creating a
	 * 							thumbnail.
	 */
	public static void createThumbnail(ThumbnailTask task) throws IOException
	{
		ThumbnailParameter param = task.getParam();
		
		BufferedImage sourceImage = task.read();
		BufferedImage destinationImage = new BufferedImageBuilder(
				param.getSize(),
				param.getType()
		).build(); 
		
		// Create thumbnail
		Dimension sourceSize = new Dimension(sourceImage.getWidth(), sourceImage.getHeight());
		Dimension destinationSize = param.getSize();
		
		Resizer r = ResizerFactory.getResizer(sourceSize, destinationSize);
		r.resize(sourceImage, destinationImage);
		
		// Add watermarks
		for (Watermark w : param.getWatermarks())
		{
			destinationImage = w.apply(destinationImage);
		}
		
		task.write(destinationImage);
	}
}<commit_msg>* Changed implementation to use FixedSizeThumbnailMaker.<commit_after>package net.coobird.thumbnailator;

import java.awt.Dimension;
import java.awt.image.BufferedImage;
import java.io.IOException;

import net.coobird.thumbnailator.filters.Watermark;
import net.coobird.thumbnailator.makers.FixedSizeThumbnailMaker;
import net.coobird.thumbnailator.resizers.ResizerFactory;
import net.coobird.thumbnailator.tasks.ThumbnailTask;

/**
 * This class provides utilities methods to exectute {@link ThumbnailTask}s.
 * 
 * @author coobird
 *
 */
public class Thumbnailator
{
	/**
	 * This class is not intended to be instantiated.
	 */
	private Thumbnailator() {}
	
	/**
	 * Creates a thumbnail from parameters specified in a {@link ThumbnailTask}.
	 * 
	 * @param task				A {@link ThumbnailTask} to execute.
	 * @throws IOException		Thrown when a problem occurs when creating a
	 * 							thumbnail.
	 */
	public static void createThumbnail(ThumbnailTask task) throws IOException
	{
		ThumbnailParameter param = task.getParam();
		
		// Obtain the original image.
		BufferedImage sourceImage = task.read();

		// Get the dimensions of the original and thumbnail images. 
		Dimension sourceSize = 
			new Dimension(sourceImage.getWidth(), sourceImage.getHeight());
		Dimension destinationSize = param.getSize();
		int destinationWidth = param.getSize().width;
		int destinationHeight = param.getSize().height;
		
		// Create the thumbnail.
		BufferedImage destinationImage =
			new FixedSizeThumbnailMaker()
				.size(destinationWidth, destinationHeight)
				.keepAspectRatio(param.isKeepAspectRatio())
				.imageType(param.getType())
				.resizer(ResizerFactory.getResizer(sourceSize, destinationSize))
				.make(sourceImage);
		
		// Add watermarks.
		for (Watermark w : param.getWatermarks())
		{
			destinationImage = w.apply(destinationImage);
		}
		
		// Write the thumbnail image to the destination.
		task.write(destinationImage);
	}
}
{'fraction_non_alphanumeric': 0.09943977591036414, 'fraction_numerical': 0.0, 'mean_word_length': 4.274741506646972, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1363386', 'n_tokens_mistral': 1179, 'n_tokens_neox': 1060, 'n_words': 258}