diff --git a/Kitodo-API/src/main/java/org/kitodo/api/imagemanagement/ImageManagementInterface.java b/Kitodo-API/src/main/java/org/kitodo/api/imagemanagement/ImageManagementInterface.java index 27c1e34b036..3864ffecd4d 100644 --- a/Kitodo-API/src/main/java/org/kitodo/api/imagemanagement/ImageManagementInterface.java +++ b/Kitodo-API/src/main/java/org/kitodo/api/imagemanagement/ImageManagementInterface.java @@ -50,20 +50,6 @@ public interface ImageManagementInterface { boolean createDerivative(URI imageFileUri, double percent, URI resultFileUri, ImageFileFormat resultFileFormat) throws IOException; - /** - * Scales an image at a given path and returns it. - * - * @param imageFileUri - * the URI to the image which should be scaled - * @param percent - * the percentage for scaling - * @return the scaled image - * @throws IOException - * if the plug-in is configured incorrectly, the image is - * missing or corrupted, etc. - */ - Image getScaledWebImage(URI imageFileUri, double percent) throws IOException; - /** * Changes the size (in pixel) of the image. * @@ -77,5 +63,4 @@ boolean createDerivative(URI imageFileUri, double percent, URI resultFileUri, Im * missing or corrupted, etc. */ Image getSizedWebImage(URI imageFileUri, int pixelWidth) throws IOException; - } diff --git a/Kitodo-DataManagement/src/main/java/org/kitodo/data/database/beans/Folder.java b/Kitodo-DataManagement/src/main/java/org/kitodo/data/database/beans/Folder.java index 06cc6decc8d..961fa32ef4a 100644 --- a/Kitodo-DataManagement/src/main/java/org/kitodo/data/database/beans/Folder.java +++ b/Kitodo-DataManagement/src/main/java/org/kitodo/data/database/beans/Folder.java @@ -106,15 +106,6 @@ public class Folder extends BaseBean { @Column(name = "fileGroup") private String fileGroup; - /** - * If not null, images in this folder can be generated by the function - * {@link ImageManagementInterface#getScaledWebImage(java.net.URI, double)}. - * The value is the factor of scaling for the derivative, a value of 1.0 - * indicates the original size. - */ - @Column(name = "imageScale") - private Double imageScale = null; - /** * If not null, images in this folder can be generated by the function * {@link ImageManagementInterface#getSizedWebImage(java.net.URI, int)}. The @@ -213,17 +204,6 @@ public Collection getFileGroups() { return fileGroups; } - /** - * Returns the scale factor to get the contents of the folder as scaled web - * images form the content of another folder, if any. If absent, the - * function is disabled. - * - * @return the scale factor. A value of 1.0 refers to the original size. - */ - public Optional getImageScale() { - return Optional.ofNullable(imageScale); - } - /** * Returns the pixel width to get the contents of the folder as sized web * images form the content of another folder, if any. If absent, the @@ -383,18 +363,6 @@ public void setFileGroup(String fileGroup) { this.fileGroup = fileGroup; } - /** - * Sets the scale factor to get the contents of the folder as scaled web - * images form the content of another folder. Can be set to {@code null} to - * disable the function. - * - * @param imageScale - * the scale factor. A value of 1.0 refers to the original size. - */ - public void setImageScale(Double imageScale) { - this.imageScale = imageScale; - } - /** * Returns the pixel width to get the contents of the folder as sized web * images form the content of another folder, if any. If absent, the diff --git a/Kitodo-DataManagement/src/main/java/org/kitodo/data/database/beans/Task.java b/Kitodo-DataManagement/src/main/java/org/kitodo/data/database/beans/Task.java index ab78555242c..8c5dd7d1f9d 100644 --- a/Kitodo-DataManagement/src/main/java/org/kitodo/data/database/beans/Task.java +++ b/Kitodo-DataManagement/src/main/java/org/kitodo/data/database/beans/Task.java @@ -400,7 +400,7 @@ public List getContentFolders() { List contentFolders = typeGenerateImages ? process.getProject().getFolders().parallelStream() .filter(folder -> folder.getDerivative().isPresent() || folder.getDpi().isPresent() - || folder.getImageScale().isPresent() || folder.getImageSize().isPresent()) + || folder.getImageSize().isPresent()) .collect(Collectors.toList()) : Collections.emptyList(); return contentFolders; diff --git a/Kitodo-DataManagement/src/main/resources/db/migration/V2_129__Delete_column_imageScale.sql b/Kitodo-DataManagement/src/main/resources/db/migration/V2_129__Delete_column_imageScale.sql new file mode 100644 index 00000000000..d164356bbee --- /dev/null +++ b/Kitodo-DataManagement/src/main/resources/db/migration/V2_129__Delete_column_imageScale.sql @@ -0,0 +1,14 @@ +-- +-- (c) Kitodo. Key to digital objects e. V. +-- +-- This file is part of the Kitodo project. +-- +-- It is licensed under GNU General Public License version 3 or later. +-- +-- For the full copyright and license information, please read the +-- GPL3-License.txt file that was distributed with this source code. +-- + +-- +-- Delete column for image generation option "getScaledWebImage" +ALTER TABLE folder DROP COLUMN imageScale; diff --git a/Kitodo-ImageManagement/src/main/java/org/kitodo/imagemanagement/ImageManagement.java b/Kitodo-ImageManagement/src/main/java/org/kitodo/imagemanagement/ImageManagement.java index 3132444faee..1fe25a646e1 100644 --- a/Kitodo-ImageManagement/src/main/java/org/kitodo/imagemanagement/ImageManagement.java +++ b/Kitodo-ImageManagement/src/main/java/org/kitodo/imagemanagement/ImageManagement.java @@ -96,19 +96,6 @@ public boolean createDerivative(URI sourceUri, double factor, URI resultUri, Ima return new File(resultUri).exists(); } - /** - * {@inheritDoc} - * - * @see org.kitodo.api.imagemanagement.ImageManagementInterface#getScaledWebImage(java.net.URI, - * double) - */ - @Override - public Image getScaledWebImage(URI sourceUri, double factor) throws IOException { - validateParameters(sourceUri, factor); - return summarize("scaledWebImage-", WEB_IMAGE_FORMAT, sourceUri, lambda -> lambda.resize(factor), - "Generating scaled web image from {} as {}, factor {}%", 100 * factor); - } - /** * {@inheritDoc} * diff --git a/Kitodo-ImageManagement/src/test/java/org/kitodo/imagemanagement/ImageManagementIT.java b/Kitodo-ImageManagement/src/test/java/org/kitodo/imagemanagement/ImageManagementIT.java index f656874c9c2..1b293d2dc80 100644 --- a/Kitodo-ImageManagement/src/test/java/org/kitodo/imagemanagement/ImageManagementIT.java +++ b/Kitodo-ImageManagement/src/test/java/org/kitodo/imagemanagement/ImageManagementIT.java @@ -96,15 +96,6 @@ public static void createTestTiff() throws IOException, InterruptedException, IM convertCmd.run(operation); } - @Test - public void testGetScaledWebImage() throws IOException, InfoException { - assert new File(_00000001_TIF).exists(); - ImageManagementInterface module = new ImageManagement(); - Image scaledWebImage = module.getScaledWebImage(new File(_00000001_TIF).toURI(), 0.3); - assertEquals((int) Math.round(0.3 * new Info(_00000001_TIF, true).getImageWidth()), - scaledWebImage.getWidth(null)); - } - @Test public void testCreateDerivative() throws IOException, InfoException { assert new File(_00000001_TIF).exists(); diff --git a/Kitodo/src/main/java/org/kitodo/production/services/command/KitodoScriptService.java b/Kitodo/src/main/java/org/kitodo/production/services/command/KitodoScriptService.java index ac4abe05ba1..368a7bec02f 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/command/KitodoScriptService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/command/KitodoScriptService.java @@ -415,7 +415,7 @@ private void generateImages(List processes, GenerationMode generationMo for (Folder folder : process.getProject().getFolders()) { if ((all || folders.contains(folder.getPath())) && !folder.equals(generatorSource) && (folder.getDerivative().isPresent() || folder.getDpi().isPresent() - || folder.getImageScale().isPresent() || folder.getImageSize().isPresent())) { + || folder.getImageSize().isPresent())) { outputFolders.add(new Subfolder(process, folder)); ungeneratableFolders.remove(folder.getPath()); } diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/FolderService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/FolderService.java index 56ba34ec657..b9a45b4aadb 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/FolderService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/FolderService.java @@ -96,7 +96,6 @@ public Folder cloneFolder(Folder source) { clone.setCreateFolder(source.isCreateFolder()); clone.setDerivative(source.getDerivative().orElse(null)); clone.setDpi(source.getDpi().orElse(null)); - clone.setImageScale(source.getImageScale().orElse(null)); clone.setImageSize(source.getImageSize().orElse(null)); clone.setLinkingMode(source.getLinkingMode()); return clone; diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/TaskService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/TaskService.java index 6daec1aa77e..753b277cdbf 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/TaskService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/TaskService.java @@ -831,7 +831,7 @@ private static Stream dropOwnSourceFolders(Stream projects) { */ private static Stream removeFoldersThatCannotBeGenerated(Stream folders) { return folders.filter(folder -> folder.getDerivative().isPresent() || folder.getDpi().isPresent() - || folder.getImageScale().isPresent() || folder.getImageSize().isPresent()); + || folder.getImageSize().isPresent()); } /** diff --git a/Kitodo/src/main/java/org/kitodo/production/services/image/ImageGenerator.java b/Kitodo/src/main/java/org/kitodo/production/services/image/ImageGenerator.java index 2eb73738f90..d2fff17c20d 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/image/ImageGenerator.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/image/ImageGenerator.java @@ -339,12 +339,9 @@ public void letTheSupervisorDo(Consumer action) { */ private Image retrieveJavaImage(URI sourceImage, Folder imageProperties) throws IOException { Optional optionalDpi = imageProperties.getDpi(); - Optional optionalImageScale = imageProperties.getImageScale(); Optional optionalImageSize = imageProperties.getImageSize(); if (optionalDpi.isPresent()) { return imageService.changeDpi(sourceImage, optionalDpi.get()); - } else if (optionalImageScale.isPresent()) { - return imageService.getScaledWebImage(sourceImage, optionalImageScale.get()); } else if (optionalImageSize.isPresent()) { return imageService.getSizedWebImage(sourceImage, optionalImageSize.get()); } diff --git a/Kitodo/src/main/java/org/kitodo/production/services/image/ImageService.java b/Kitodo/src/main/java/org/kitodo/production/services/image/ImageService.java index 52b7ea68c54..d08fa27e06a 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/image/ImageService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/image/ImageService.java @@ -71,22 +71,6 @@ boolean createDerivative(URI imageFileUri, double percent, URI resultFileUri, Im return imageManagement.createDerivative(imageFileUri, percent, resultFileUri, resultFileFormat); } - /** - * Scales an image at a given path and returns it. - * - * @param imageFileUri - * the URI to the image which should be scaled - * @param percent - * the percentage for scaling - * @return the scaled image - * @throws IOException - * if the plug-in is configured incorrectly, the image is - * missing or corrupted, etc. - */ - Image getScaledWebImage(URI imageFileUri, double percent) throws IOException { - return imageManagement.getScaledWebImage(imageFileUri, percent); - } - /** * Changes the size (in pixel) of the image. *