2
$\begingroup$

I originally created a package (.m file) which handled figure formatting. This package was read into my desktop notebook file. In the code block below, I use ImageResize[image,width] to resize an image imported from a location on the desktop - this works fine. The second code block below is where the problem occurs

ImageMod2[ImageName_, ImageTitle_, SetImageSize_, nFigure_] := 
 Module[{HM, HMLabel, ImName = ImageName, CapColor = Black,
    nFig = nFigure},
    nFig = nFig + 1;
    HM = ImageResize[
    Import["C:\\Users\\xxx\\eclipse-workspace\\Documentation\\\
Images/" <> ImName], SetImageSize];
    HMLabel = 
   Style["Fig." <> " " <> ToString[nFig] <> "- " <> ImageTitle, Black,
     16, FontFamily -> "Source Sans Pro"];
    Grid[{{Show[HM]}, {HMLabel, SpanFromLeft}}, Alignment -> Center]
    ]

In this package below, which is stored in Wolfram Cloud,the code is modified to import from a file in a cloud location. Everything works fine, except that the ImageResize stops resizing the image when I set the size to about 150. Two examples are discussed below the code block

ImageMod2[ImageName_, ImageTitle_, SetImageSize_, nFigure_] := 
 Module[{HM, HMLabel, ImName = ImageName, CapColor = Black,
    nFig = nFigure},
    nFig = nFig + 1;
    HM = ImageResize[
    CloudImport[
     "https://www.wolframcloud.com/obj/xxx/Base/\
ImagesCloud/" <> ImName], SetImageSize];
    HMLabel = 
   Style["Fig." <> " " <> ToString[nFig] <> "- " <> ImageTitle, Black,
     16, FontFamily -> "Source Sans Pro"];
    Grid[{{Show[HM]}, {HMLabel, SpanFromLeft}}, Alignment -> Center]
    ]

The following two pieces of code produce the same image size when running a notebook online in Wolfram Cloud although one has an image size of 370 and the other 200

TablesPlotsCloud`ImageMod2["2PhaseSep.PNG","2 Phase Setup",370,nFig]
TablesPlotsCloud`ImageMod2["2PhaseSep.PNG","2 Phase Setup",200,nFig]

Any feedback is greatly appreciated.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.